Computer Hope

Microsoft => Microsoft Windows => Windows XP => Topic started by: jami.francis on May 21, 2012, 07:25:00 PM

Title: writing a simple batch file to shutdown pc in x minutes
Post by: jami.francis on May 21, 2012, 07:25:00 PM
Hi - I currently have many xp shortcuts in a folder that allow me to shut down my pc in x number of seconds   For example I'm using C:\WINDOWS\system32\shutdown.exe -f -s -t 2400   in a shortcut to shut down in 40 minutes. 

I'm trying to write a batch file that will prompt me for the number of MINUTES in which the pc should shut down.

Can some one help me fill in the blanks here - I don't know what I'm doing...  thanks, Jami

@echo off
echo Minutes until shut down?
echo.
rem enter minutes press - then hit enter
set /p min=[promptString]

rem multiplies minutes by 60 for seconds (sec)

rem drops the product into the shutdown statement
C:\WINDOWS\system32\shutdown.exe -f -s -t sec


Title: Re: writing a simple batch file to shutdown pc in x minutes
Post by: Helpmeh on May 21, 2012, 08:12:47 PM
Code: [Select]
@echo off
echo Minutes until shut down?
echo.
set /p min=Minutes:
set /a sec=%min%*60
shutdown -s -f -t %sec%