Our building will have a power failure at a particular time. You may want your computer to stay on til just before the power goes out due to various reasons:

 

  • It may be a web or file server serving other clients around the world.
  • You may want to access it from a remote location

 

Choose Start->Control Panel->Scheduled Tasks. Right click (or hit the Context menu button on your keyboard) and choose Open. (this avoids the Scheduled Task Wizard)

 

Choose File->New->Scheduled task and give it a name. Hit Enter or dbl-click on it to tell it what to do. I want it to run the Shutdown command in a command prompt.

 

Be sure the Run As, password are set, so the task has the rights to run.

 

So type in “cmd /c shutdown –f –s” and schedule it as you like.

 

 

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

 

        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)

 

Over the years, I’ve used the task scheduler to run various processes (like compiling or syncing) automatically.

 

 

On Vista, choose Control Panel->Admin Tools->Task Scheduler. Make sure to choose Task Scheduler Library from the treeview on the left to see tasks you create. You can easily just display a messagebox to your user. For example, you could make it display an annoying message every hour. Vista allows you to run a task at various events, such as Log On, StartUp, idle, etc.

 

 

There is also the AT command:

AT /?

The AT command schedules commands and programs to run on a computer at

a specified time and date. The Schedule service must be running to use

the AT command.

 

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]

AT [\\computername] time [/INTERACTIVE]

    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

 

\\computername     Specifies a remote computer. Commands are scheduled on the

                   local computer if this parameter is omitted.

id                 Is an identification number assigned to a scheduled

                   command.

/delete            Cancels a scheduled command. If id is omitted, all the

                   scheduled commands on the computer are canceled.

/yes               Used with cancel all jobs command when no further

                   confirmation is desired.

time               Specifies the time when command is to run.

/interactive       Allows the job to interact with the desktop of the user

                   who is logged on at the time the job runs.

/every:date[,...]  Runs the command on each specified day(s) of the week or

                   month. If date is omitted, the current day of the month

                   is assumed.

/next:date[,...]   Runs the specified command on the next occurrence of the

                   day (for example, next Thursday).  If date is omitted, the

                   current day of the month is assumed.

"command"          Is the Windows NT command, or batch program to be run.

 

But

 

See also

 

Task Scheduler

 

Windows Vista Task Scheduler

 

How To Use the Remote Shutdown Tool to Shut Down and Restart a Computer in Windows 2000

 

You Cannot Schedule a Windows XP-Based Computer to Shut Down and Restart by Using the AT Command with Shutdown.exe