Picture this: it’s 12am and you want to go to bed but you’re in the middle of a download. You know the ETA for download completion is less than 2 hours. Wouldn’t it be great if there was a way to automatically shut down Windows at 2am after the download completes while you sleep instead of leaving it on all night? There are tools out there that can do this, either freeware or shareware, but why bother with installing another application when Windows is perfectly capable of automated shutdowns natively?
I’m talking about Scheduled Tasks combined with shutdown.exe, both tools provided by Windows. Scheduled Tasks gives you an easy interface to schedule an application to run at a certain time. Shutdown.exe is a DOS command that can locally and remotely shut down your computer.
First let’s take a look at how to use shutdown.exe. Here is the DOS documentation:
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]What we’re particularly interested are the “-s” and “-f” parameters as you’ll see later. Next let’s bring up Windows Scheduled Tasks by going to Start -> Accessories -> System Tools -> Scheduled Tasks.
No args Display this message (same as -?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c “comment” Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)
Now double click on “Add Scheduled Task” and hit “Browse” to look for shutdown.exe.
Browse for shutdown.exe located in C:\WINDOWS\System32\shutdown.exe. It proclaims itself to be the Windows Remote Shutdown Tool although in our case we’re using it to shutdown our local computer.
Give the task any name you want, in my case I used “Auto Shutdown” and make sure to check “One time only” as you probably don’t want to be doing this daily, weekly, or monthly!
Keep clicking through the self-explanatory dialogs, being sure to provide your Windows password when needed until the last prompt. At this point you will need to customize the shutdown command slightly further (remember -s and -f?) so check “Open advanced properties” before you hit finish.
As the advanced dialog opens, add “-s -f” to the end of the command as shown in the red box. The “-s” option specifies a shutdown (versus a restart with “-r”) and the “-f” command forces all applications to close.
When everything is done, you will see a new scheduled task. You can now to go sleep.
No comments:
Post a Comment