Hi Everyone,

I have created a simple batch file which uses three 'AT' commands to schedule tasks. The tasks are set to run on a Friday, Saturday and Sunday night respectively at 23:00, and are simply a defrag of the two partitions on my system and a Spyware scan also.

I have included the AT commands below:

at 23:00 /every:f "c:\WINNT\system32\dfrg.exe d: -f"

at 23:00 /every:s "c:\WINNT\system32\dfrg.exe c: -f"

at 23:00 /every:su "c:\program files\microsoft antispyware\giantantispywaremain.exe -scan -withoutui"

The script runs fine and schedules the tasks but if I try and run any of the three immediately I get an error in Event Viewer 7901: The System cannot find the file specified.

The OS I am running is Windows 2000 Professional and to my knowledge both the defragmenter and Spyware software are DEFINATELY in the locations specified above. So I am perplexed as to why "The System cannot find the file specified".

Does anyone have any suggestions as to what could be causing the problem??? And how best to rectify it???

Thank you in advance for your anticipated assistance.

Kind Regards,

Darren King

Recommended Answers

Could you not run it throught scheduled tasks in the control pannel

Jump to Post

All 4 Replies

Could you not run it throught scheduled tasks in the control pannel

Could you not run it throught scheduled tasks in the control pannel

Hi Marty,

The 'AT' commands place an entry in the Scheduled Tasks pane under Control panel for each job. The reason I am using a batch file rather than just creating them manually within Scheduled Tasks is we plan to push this script out using Group Policy.

But I am testing the batch file locally on my machine first but I am getting this issue. It does create the Scheduled Tasks but they fail immediately with the earlier mentioned error.

Any idea as to what the problem could be???

Thanks in advance for your assistance.


Darren King

I spent 30mins looking at this, with interest, and cant work out what you have done wrong.

The script looks perfect as long as you have the right location and file name. How come your defrag isn't defrag.exe.

Must be something with the location and command, because the rest is fine.

But if you can run

c:\WINNT\system32\dfrg.exe d: -f

from the run command in start menu, then....

I use psexec and contig http://www.sysinternals.com
instead of scheduling I use one computer to push the defrag and run it on 200 computers every weekend.

psexec \\* -c -u Administrator -p Password contig -q -s c:\*.*

(\\*) Pushes it out to all computers in net view

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.