Computing.Net > Forums > Programming > Batch file shutdown timer

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file shutdown timer

Reply to Message Icon

Name: coolduderyan07
Date: February 10, 2006 at 17:47:23 Pacific
OS: Windows XP home ed.
CPU/Ram: pentium 4 Windows Xp 512
Product: Dell
Comment:

Hello,
I registered here asking for a bit of help. First off I am very new to this language and i need to make a little program off a batch file. I found out how to shutdown the computer using a batch file.. and how to set a specified time to shut off... the only thing that is in my way.. is basically.. that is all i can do really..

1st it would be nice if someone could help me with some commands... What i want is to have a menu with choices displayed after the batch file is launched that gives you 3 things to choose from.. shutdown in 15 minutes.. shutdown in 30 minutes or shutdown in 60 minutes.. so far all I have is..

Code :

shutdown -s -f -t 300

-(300) is 300 seconds
Yea thats pretty much what i am limited to.. it would be really great to have some help on this. Thanks in advance.

Ryan



Sponsored Link
Ads by Google

Response Number 1
Name: CWoodward
Date: February 10, 2006 at 20:09:48 Pacific
Reply:

Try this:

@ECHO OFF

CLS

:Start
ECHO When do you want to shutdown?
ECHO Press number of choice followed by the Enter key
ECHO 1: Fifteen Minutes
ECHO 2: Thirty Minutes
ECHO 3: Sixty Minutes
ECHO 4: Quit

SET Choice=
SET /P Choice=""

IF '%Choice%'=='1' GOTO Fifteen
IF '%Choice%'=='2' GOTO Thirty
IF '%Choice%'=='3' GOTO Sixty
IF '%Choice%'=='4' GOTO End
CLS
ECHO "%Choice%" is not valid
ECHO Try again
GOTO Start

:Fifteen
SHUTDOWN -S -F -T 900
GOTO End

:Thirty
SHUTDOWN -S -F -T 1800
GOTO End

:Sixty
SHUTDOWN -S -F -T 3600
GOTO End

:End
CLS


0

Response Number 2
Name: CWoodward
Date: February 10, 2006 at 20:12:13 Pacific
Reply:

You can delete the line:

IF '%Choice%'=='4' GOTO End

If you don't want the shutdown to be optional.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Game Development Help Advance rename



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file shutdown timer

Batch file interval timer www.computing.net/answers/programming/batch-file-interval-timer/11860.html

Batch file to remotely shutdown www.computing.net/answers/programming/batch-file-to-remotely-shutdown-/13703.html

Batch file to remote shutdown network PC's www.computing.net/answers/programming/batch-file-to-remote-shutdown-network-pcs/19105.html