Historie úprav

Avatar uživatele

Zeptal/a se – 4.říjen 22:45

Jak udělat v .bat, že když mám odpočítávání tak během něj kliknutím na C se automaticky přeruší a odkáže mě to zpět.

Počítače a internet – Programování a webdesign

@echo off
color C
:start
cls
echo.
echo _____________­________________________­_________________________
echo I will shutdown computer [Y/N] or you can [1]Choose from menu:
echo.
echo.
echo.
@CHOICE /c:YN1
IF ERRORLEVEL 3 GOTO 1
IF ERRORLEVEL 2 GOTO N
IF ERRORLEVEL 1 GOTO Y

goto end
:1

cls
:start
color E
echo.
echo MENU
echo _____________­_______________
echo.
echo.
echo 1. [S]leep mode
echo.
echo 2. [H]ibernate pc
echo.
echo 3. [L]ock workstation
echo.
echo 4. [R]estart
echo.
echo 5. [E]xit
echo.
echo _____________­_______________
@CHOICE /C:SHLRE
IF ERRORLEVEL 5 GOTO N
IF ERRORLEVEL 4 GOTO R
IF ERRORLEVEL 3 GOTO L
IF ERRORLEVEL 2 GOTO H
IF ERRORLEVEL 1 GOTO S

goto end
:Y

cls
color E
echo Really?
@CHOICE /C:YN
IF ERRORLEVEL 2 GOTO N
IF ERRORLEVEL 1 GOTO X

goto end
:X
echo I am shuting down computer in 20 seconds
timeout /t 1 /nobreak >nul
echo [C]ancel 20

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 19

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 18

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 17

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 16

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 15

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 14

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 13

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 12

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 11

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 10

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 9

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 8

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 7

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 6

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 5

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 4

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 3

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 2

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 1

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
:start
shutdown -p

goto end
:N
echo.
echo Ending, please wait . . .
echo.
echo.
:start
timeout /t 3 /nobreak > nul
:start
exit

goto end
:S
:start
sleep
:start
exit

goto end
:H
:start
rundll32.exe powrProf.dll,Set­SuspendState
:start
exit

goto end
:L
:start
rundll32.exe user32.dll,Loc­kWorkStation
:start
exit

goto end
:R
:start
shutdown.exe -r -t 00

goto end
:C
:start
shutdown -a
echo.
echo Shutdown canceled
pause
goto :1

_____________­________________________­________________________­________
echo [C]ancel 11
„co sem vložit, aby po zmáčknutí se provedl příkaz pod ním ovšem pokud se nic nezmáčkne tak aby odpočítávání jelo dál samo??????“
IF ERRORLEVEL 1 GOTO C

Avatar uživatele

Zeptal/a se – 5.říjen 10:30

Jak udělat v .bat, že když mám odpočítávání tak během něj kliknutím na C se automaticky přeruší a odkáže mě to zpět.

Počítače a internet – Programování a webdesign

@echo off
color C
:start
cls
echo.
echo _____________­________________________­_________________________
echo I will shutdown computer [Y/N] or you can [1]Choose from menu:
echo.
echo.
echo.
@CHOICE /c:YN1
IF ERRORLEVEL 3 GOTO 1
IF ERRORLEVEL 2 GOTO N
IF ERRORLEVEL 1 GOTO Y

goto end
:1

cls
:start
color E
echo.
echo MENU
echo _____________­_______________
echo.
echo.
echo 1. [S]leep mode
echo.
echo 2. [H]ibernate pc
echo.
echo 3. [L]ock workstation
echo.
echo 4. [R]estart
echo.
echo 5. [E]xit
echo.
echo _____________­_______________
@CHOICE /C:SHLRE
IF ERRORLEVEL 5 GOTO N
IF ERRORLEVEL 4 GOTO R
IF ERRORLEVEL 3 GOTO L
IF ERRORLEVEL 2 GOTO H
IF ERRORLEVEL 1 GOTO S

goto end
:Y

cls
color E
echo Really?
@CHOICE /C:YN
IF ERRORLEVEL 2 GOTO N
IF ERRORLEVEL 1 GOTO X

goto end
:X
echo I am shuting down computer in 20 seconds
timeout /t 1 /nobreak >nul
echo [C]ancel 20

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 19

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 18

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 17

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 16

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 15

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 14

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 13

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 12

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 11

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 10

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 9

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 8

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 7

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 6

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 5

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 4

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 3

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 2

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
echo [C]ancel 1

IF ERRORLEVEL 1 GOTO C
:start
timeout /t 1 /nobreak >nul
cls
:start
shutdown -p

goto end
:N
echo.
echo Ending, please wait . . .
echo.
echo.
:start
timeout /t 3 /nobreak > nul
:start
exit

goto end
:S
:start
sleep
:start
exit

goto end
:H
:start
rundll32.exe powrProf.dll,Set­SuspendState
:start
exit

goto end
:L
:start
rundll32.exe user32.dll,Loc­kWorkStation
:start
exit

goto end
:R
:start
shutdown.exe -r -t 00

goto end
:C
:start
shutdown -a
echo.
echo Shutdown canceled
pause
goto :1

_____________­________________________­________________________­________
echo [C]ancel 11
„co sem vložit, aby po zmáčknutí se provedl příkaz pod ním ovšem pokud se nic nezmáčkne tak aby odpočítávání jelo dál samo??????“
IF ERRORLEVEL 1 GOTO C
Doplňuji:
takže jsem to vyřešil tak, že na konec jsem vložil:

CHOICE /C C /N /T 4 /D C /M " [C]ancel ?! :

jinak to asi moc dobře nepůjde :(