We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Scheduled BAT Job on Windows Server Running But Not Executing Commands

stargazerm31
stargazerm31 asked
on
Medium Priority
383 Views
Last Modified: 2012-05-11
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
Comment
Watch Question

Author

Commented:
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.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
MichaelSystems Engineer

Commented:
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.

Author

Commented:
Thanks for the code.  That did it.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.