Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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 8.1 Pro RTM x64
 
 

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
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 8 Core X64
 
 

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 8.1 Pro RTM x64
 
 

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..
My System SpecsSystem Spec
Reply

 Auto shutdown batch file help




Thread Tools




Our Sites

Site Links

About Us

Find Us

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

All times are GMT -5. The time now is 09:11 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

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 33