Link to home
Start Free TrialLog in
Avatar of stargazerm31
stargazerm31

asked on

Scheduled BAT Job on Windows Server Running But Not Executing Commands

Hello all,

I have a strange one.  I have a Windows 2003 Server Standard Edition that has a Bat job that sets the drive letter, changes a directory and then DEL *.txt.  When I double click on the BAT job, it executes just fine.  No issues and it deletes everything in the directory.  When I schedule the BAT job, it acts like it runs.  Does not give me any error, but it does not delete the files.

Any idea why?

Thanks
Avatar of stargazerm31
stargazerm31

ASKER

Interesting.  I commented out the DEL and added a DIR *.txt >> file.txt and it appears that it is not remembering the setting for directory letter and not changing directory because it is executing the DIR in the directory of the BAT file.  I still don't have a great answer for how to do this.
ASKER CERTIFIED SOLUTION
Avatar of needleboy
needleboy
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another thing is, you may have to run the job as an administrator. There is a setting in the Scheduled Jobs area to input this.
Thanks for the code.  That did it.