i want to do a shutdown batch there you should coose how much time it is like this:
@echo off
title Shutdown
echo.
echo.
echo In How many seconds do you want to shutdown?
echo 60 min is 3600 sec.
set /p c==option
if %c%
exithow should i do so i dont must do like this:
@echo off
title Shutdown
echo.
echo.
echo In How many seconds do you want to shutdown?
echo 60 min is 3600 sec.
set /p c==option
if %c%==1 goto 1
if %c%==2 goto 2
if %c%==3 goto 3
if %c%==4 goto 4
if %c%==5 goto 5
:1
start shutdown -s -t 1
exit
:2
start shutdown -s -t 2
exit
:3
start shutdown -s -t 3
exit
:4
start shutdown -s -t 4
exit
:5
start shutdown -s -t 5
exit
@echo off title Shutdown echo.% echo. echo In How many seconds do you want to shutdown? echo 10 min is 600 sec (Max value is 600). set /p sec=> for /L %%j in (1 1 600) do if "%Sec%"=="%%j" shutdown -s -t %%j echo.& echo.Invalid value entered pause
Did not work.
What *exactly* happens? Do you get an error message or what else? When calling your medical doctor you say I have a problem with my head or my legs not just I am not fine.
OK, I found the mistake by myself; the following version does the job
@echo off title Shutdown echo.& echo. echo.In How many seconds do you want to shutdown? echo.10 mins are 600 secs (Max value is 600). set /P sec=^> for /L %%j in (1 1 600) do if "%sec%"=="%%j" shutdown -s -t %%j echo.& echo.Invalid value entered: Sec= %sec% pause
Why just 600 and not more?
Because you will get a (error) message of "Invalid value entered".. Change the 600 to whatever of number. (line 7)
MUs
Happy is ONE who says I am an OttoMAN.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |