Windows 7 Forums


Windows 7: Auto shutdown batch file help

01 Jan 2011   #1

Windows 7 64bit
 
 
Auto shutdown batch file help

Happy new year everyone,

I'm looking to create a batch file to auto shut down my machine after a certain amount of time. Just want to check if i have got the 1st part of the command right in notepad but i was not sure how i go about putting in a timer for example if my download has 2hrs left i would like to set the batch to run say 2hrs 30mins after running it.


@echo off

shutdown /s

Hope you can help many thanks

My System SpecsSystem Spec

01 Jan 2011   #2

Windows 7 Ultimate x64 Service Pack 1
Doncaster, UK
 
 

You need to add the /t xxx switch where xxx is the time delay in seconds. So for 2hrs 30mins, xxx would be 9000. This means that your code should read as follows:

Code:
@echo off
shutdown /s /t 9000
To cancel before the time elapses, use the following command: shutdown /a

Shut Down Computer Shortcut - Create

Abort Shortcut - Create

Last edited by Brink; 01 Jan 2011 at 11:50 AM.. Reason: added links ;)
My System SpecsSystem Spec
01 Jan 2011   #3

Windows 7 64bit
 
 

Thanks for that mate really appreciate it, do i have to have the cancel command in the batch all the time or do i have to add it in if i decide i dont want the machine to shutdown then run the batch again?

thanks matey
My System SpecsSystem Spec
.


01 Jan 2011   #4

Windows 7 Pro X64
Space Coast of Florida
 
 

Click on the Start Orb, and enter shutdown /a to cancel the pending shutdown. It does not belong in the batch file. Alternatively, you could create another batch file with shutdown /a in it and have that on the Desktop next to the one that starts the shutdown.
My System SpecsSystem Spec
01 Jan 2011   #5

Windows 7 64bit
 
 

cool thanks so much for that mate, +rep for both of you for your kind help
My System SpecsSystem Spec
01 Jan 2011   #6

Windows 7 Ultimate x64 Service Pack 1
Doncaster, UK
 
 

You're welcome.
My System SpecsSystem Spec
01 Jan 2011   #7

Winbdows 7 ultimate x64 | Ubuntu 12.04 x64 LTS
 
 

And there's the /r switch for restart. You can also type shutdown ? in a command prompt to view all the switches and their functions..

Last edited by EzioAuditore; 01 Jan 2011 at 12:07 PM.. Reason: EDIT: Oh! My 400th post. ;)
My System SpecsSystem Spec
Reply

 Auto shutdown batch file help problems?



Thread Tools



Similar help and support threads for: Auto shutdown batch file help
Thread Forum
Solved Batch File that grabs file names from folder to insert into batch file General Discussion
Batch file to de-fragment, backup, then shutdown? General Discussion
Help creating a batch file to auto login to a website General Discussion
Shutdown PC w/ batch file (1hour) after program(game) launched Chillout Room
Batch Script to Auto Update Sysinternals Tools Software


All times are GMT -5. The time now is 01:30 PM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32