This article was previously published under Q142040
You can use the /k switch with the AT command to troubleshoot a scheduled batch job. The /k command allows you to manually run the batch job. To do so, type the following command at the MS-DOS command prompt, where xx:xx is the time in hours and minutes:
at xx:xx /interactive cmd.exe /k
When you use the Windows Resource Kit utility Soon.exe, you can simplify this command so that it runs in the next 5 seconds automatically. To do so, type the following command at a command prompt:
soon /interactive cmd.exe /k
Both of these commands open the MS-DOS command prompt at a scheduledtime and allow you to manually run the batch job.
If an MS-DOS command prompt does not open, start the Services tool in Control Panel, and then confirm that the Schedule service is started.Click the Startup button, and then confirm that the System account isselected; only the System account can interact with the desktop. Networkconnections made under the System account use a null session forcredentials; therefore, you may have to supply a user name and password forcommands such as net use.
Before you run your batch job, type the set command. When you do so,all environmental variables including the user name are listed. This command helps you understand the environment that the command scheduler is running in.
When you run the AT command line that is described in the preceding section, you can troubleshoot situations where abatch job runs successfully when it is executed from the command line, butit does not run when you execute it using the AT command.
In addition to troubleshooting the batch job, do the following:
Include the echo and pause commands in your batch file so that you can narrow the cause of the problem.
When you use the AT command, make sure you are using the correct schedule service account. To do so, start the Services tool in Control Panel, and then confirm that you are using the "Log On As" account for the Schedule service. This account determines whether the task that is scheduled to run has access to the network or the local computer.
Determine if the task requires interaction with the desktop. If so, use LocalSystem for the Schedule service. However, when you do so, network connectivity is not available unless you type the following the command line:net use \\server name\share name /U:domain\user namepassword