Why is the "at" command on Windows XP not behaving as expected?

1

On Windows XP I'm trying to add a job like this:

at 17:07 /every:s dir

I expect dir to be executed every Saturday at 17:07, however I don't see anything happens in the command line window.

Here is the log:

D:\temp>at 17:07 /every:s dir
Added a new job with job ID = 1

D:\temp>time/t
05:06 PM

D:\temp>date/t
Sat 10/02/2010

D:\temp>at
Status ID   Day                     Time          Command Line
-------------------------------------------------------------------------------
Error   1   Each S                  5:07 PM       dir

D:\temp>time/t
05:08 PM

D:\temp>

What am I missing ?

Misha Moroshko

Posted 2010-10-02T07:14:51.050

Reputation: 5 573

1AT.EXE is only included for backwards compatibility with NT4. Use SCHTASKS instead. – paradroid – 2010-10-02T07:25:29.777

Answers

1

From the Microsoft documentation page for the 'at' command,

To run a command that is not an executable (that is, .exe) file,
precede the command with cmd /c to load Cmd.exe as follows:

cmd /c dir > c:\test.out 

Also as their example shows,
if you want the 'dir' output to be usable, you should redirect it to some file.


Further, like the comment on your question describes, the documentation page notes,

Schtasks is a more powerful superset command-line scheduling tool and includes all the functionality found in the 'at' command-line utility. Use schtasks instead of at for all command-line scheduling tasks.

nik

Posted 2010-10-02T07:14:51.050

Reputation: 50 788