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
craney5

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
Dwarf

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
craney5

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
Ztruker

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
craney5

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
Dwarf

Windows 8.1 Pro RTM x64
 
 

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

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





Similar help and support threads
Thread Forum
shutdown in batch file requires Administrator
Hi all, I've been using GFI Backup 2009 for backups for a while, it does everything I want, and sends email reports after backup is complete. One of its features is to shutdown the computer after a backup, this rarley works, as it wont shutdown if a program is already running, including GFI...
General Discussion
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Batch file to de-fragment, backup, then shutdown?
Hey guys, Is there a way I can create a batch file so de-fragment my hard drive, once that has finished, backup to an external hard drive, and then one that has finished shut down the PC? Thanks, JPiiONEFOURONE
General Discussion
Help creating a batch file to auto login to a website
I have created the following batch file to automatically load and login to a site, I created it and tested it on a computer running xp, but I can't get it to work on a windows 7 machine... "@ECHO OFF TITLE Water Monitor Auto Start Up mode con: cols=42 lines=1 REM Create a time delay...
General Discussion
Shutdown PC w/ batch file (1hour) after program(game) launched
Is it possible to do this? I want to make it so that a game shuts down the computer after "X" seconds/minutes/hours of playing the game. But i want the file to be somewhat undetected. I don't want it popping up with a message saying things like "PC will shutdown in 3 minutes" or anything like that...
Chillout Room

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 02:14.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App