shutdown batch help

October 26, 2010 at 06:55:55
Specs: Windows 7
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%
exit

how 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


See More: shutdown batch help

Report •


#1
October 26, 2010 at 09:50:37
@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


Report •

#2
October 26, 2010 at 10:38:41
Did not work.

Report •

#3
October 26, 2010 at 11:48:31
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.


Report •

Related Solutions

#4
October 26, 2010 at 12:20:46
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


Report •

#5
October 28, 2010 at 08:52:14
Why just 600 and not more?

Report •

#6
October 28, 2010 at 11:00:06
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.


Report •

Ask Question