Using the AT Command

You can also use the AT command to schedule tasks. By default, the AT command is run using the LocalSystem account, which requires administrative privileges. To specify another account as the user of the AT command, follow these steps:

  1. Open Control Panel and double-click Scheduled Tasks.
  2. In the Scheduled Tasks window, open the Advanced menu and then choose AT Service Account.
  3. Click This Account and specify a particular user and password. Click OK.

The command structure for the AT command is as follows:

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

The following parameters can be used with the AT command. Used without parameters, the AT command returns a list of scheduled commands.

  • \\computername Specifies a remote computer. Without this parameter, the local computer is assumed.
  • id Indicates the identification number, if one is assigned.
  • /delete Cancels a scheduled command. If no identification number is specified, all scheduled commands on the computer will be canceled.
  • /yes Forces a yes answer to all system queries when canceling all commands.
  • time Specifies when the command is to run, expressed as hours:minutes in 24-hour notation.
  • /interactive Allows the task to interact with the desktop of the user logged on at the time the job is run.
  • /every:date[,...] Runs the command on the date specified. The date can be specified as one or more days of the week (M, T, W, Th, F, S, Su) or as one or more days of the month (numbers 1 through 31). Separate multiple dates with commas. If this parameter is omitted, the current day of the month is assumed.
  • /next:date[,...] Runs the command on the next occurrence of the specified day. If this parameter is omitted, the current day of the month is assumed.
  • command Indicates the program, batch file, or command to be run. If a path is required, use the Uniform Naming Convention (UNC) path.

Here are some important facts to keep in mind about the AT command:

  • The AT command doesn't automatically load Cmd, the command interpreter, so if the command parameter doesn't point to an executable file, you must explicitly specify Cmd, followed by the /c switch, at the beginning of the command.
  • Commands scheduled using AT run as background processes, so there is no displayed output. To redirect output to a file, use the redirection symbol (>). The redirection symbol must be preceded by the escape symbol (^), so a sample command would be at retrieve.bat ^>c:\daylog.txt.
  • If you have to use a drive letter to connect to a shared directory, include an AT command to disconnect the drive when the task is completed. Otherwise, the assigned drive letter will be neither available nor seen at the command prompt.

You can switch back and forth between the AT command and Task Scheduler, although there are some limitations. For example, if you schedule a task using AT and later modify that same task using Task Scheduler, the task is then "owned" by Task Scheduler and you can no longer access it using AT.

Real World

Autocompletion on the Command Line

The command line may be moribund, but it's far from dead. Windows 2000 includes a number of improvements in command-line functions, such as file and folder autocompletion. To turn this feature on, open a command-line window and type cmd /f:on. Now you can avoid typing long file or folder names at the command line. For example, to navigate into the Program Files folder from the root of the system drive (typically C), you'd type c:\cd p and then press Ctrl+D. The command expands immediately to c:\cd "Program Files". Press Enter to invoke that path.

For the true command-line junkie, you can change Ctrl+D to the Tab key (far easier to remember than Ctrl+D) by changing the CompletionChar (REG_DWORD) to a value of 9 in HKEY_CURRENT_USER\Software\Microsoft\Command Processor. When toggling through several possible choices, the Tab key is easier to use.

Autocompletion also works with files. Let's say you're in C:\Program Files\Windows Media Player and you would like to execute Mplayer.exe. At the command line, type mp and then press Ctrl+F. The path expands to include Mplayer.exe. Press Enter to actually execute the file.

Another command-line feature re-creates the functions of DOSKEY. Press the up and down arrows on the keyboard to navigate through recently used commands. Press F7 for a GUI-based display of recently used commands from which you can choose, also using the up and down arrows. Press Enter when you've arrived at the command you want to reuse.

For complete documentation on the command prompt, open a command window and type help cmd.



Microsoft Windows 2000 Server Administrator's Companion
Microsoft Windows 2000 Server Administrators Companion
ISBN: 0735617856
EAN: 2147483647
Year: 2003
Pages: 320

Similar book on Amazon

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