at


at

Schedules tasks (commands or programs) to run on a computer at a specified time/date and manages scheduled tasks.

Note that in WS2003 the schtasks command replaces the at command for managing and scheduling tasks from the command line (the at command is maintained only for backward compatibility with W2K/NT). See schtasks in this chapter for more info .

Syntax

 at [\   computername   ] [ [   id   ] [/delete]  [/yes] ] at [\   computername   ]   time   [/interactive] [/every:date[,...]   /next:date[,...] ]   command   

Options

None

Displays scheduled jobs.

\\computername

Specifies the name of the remote computer on which the job is run. (If omitted, the job executes on the local computer.)

id

Is the identification number assigned to the scheduled job.

/delete

Removes a job from the list of scheduled jobs. (If id is omitted, all scheduled jobs on the specified computer are canceled .)

/yes

Executes the scheduled job without prompting for confirmation.

time

Specifies when the command is to run (syntax is hours:minutes in 24- hour notation).

/interactive

Lets the scheduled job interact with the desktop of the user logged on when the job runs.

/every:date[,...]

Runs the job on specified day(s) of the week or month. Use M,T,W,Th,F,S,Su for days or the numbers 1 through 31 for dates, and separate them with commas. (If omitted, the current date is used.)

/next:date[,...]

Runs the job on the next occurrence of the specified day or date.

command

Is the command, program ( .exe or .com file), or batch file ( .bat or .cmd file) scheduled to run. Enclose the command in quotes if it includes spaces. If a path is required, use an absolute path for commands run on the local machine and a UNC path ( \\server\share ) for remote computers. (Don't use mapped drive letters because these may depend on the user who is logged on.)

Examples

Display all scheduled jobs on server Bob :

  at \Bob  

Typical output might be:

 Status ID   Day         Time     Command Line ---------------------------------------------------         1   Each M W F  2:00AM   \Bob /yes c15.bat 

Display information about job 12 on Bob :

  at \Bob 12  

Delete job 4 on the local server:

  at 4 /delete  

To execute a command that isn't a simple executable, precede it with cmd /c because the at command doesn't automatically load the command interpreter ( cmd.exe ) prior to executing commands. For example, to synchronize the clock of the current server with Bob daily at 3 a.m.:

  at 03:00 /every:M,T,W,Th,F,S,Su "cmd net time \Bob /set /yes"  

Notes

  • For a GUI command scheduler, see Tasks in Chapter 4. For a more powerful command-line task scheduler, see schtasks later in this chapter.

  • Note that jobs scheduled with at are displayed in the Scheduled Tasks folder, but if you then modify the parameters of the job using Scheduled Tasks, you can no longer access it from the command line using at .

  • You need to be a member of the local Administrators group to use this command.

  • The Task Scheduler service must be running to use this command. Use the Services console to start this service if necessary. (By default, this service is set to start automatically when the system is booted .)

  • Scheduled jobs are stored in the registry and aren't lost if you restart the Scheduled Tasks service.

  • The current directory for executing a scheduled command is %SystemRoot% .

  • Scheduled jobs run as background processes, and no output is displayed on the screen. You can redirect screen output to a file instead by using the redirection symbol (>).

  • If you change the system time on a computer after scheduling a job to run on it, be sure to synchronize the command scheduler with the new time by typing at without options.

  • If a scheduled job uses a mapped drive letter to connect to a network share, be sure to schedule a second job that disconnects the drive when you are finished using it; otherwise , the drive letter will not be available from the command prompt.

See Also

schtasks , Tasks



Windows Server 2003 in a Nutshell
Windows Server 2003 in a Nutshell
ISBN: 0596004044
EAN: 2147483647
Year: 2003
Pages: 415
Authors: Mitch Tulloch

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net