Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have batch file that need to run every day at 9 AM and create log. batch file works fine manually (by clicking it or from command line). However, When i set up the task by using task scheduler, it fails to run. (cmd.exe quickly shows up and shuts down and task is complete. (@ task scheduler log) However, no log has been created. I also tried putting pause in my program to hope that my program is being executed, but sadly it isn't.

Can anyone tell me what is the solution to this? Thanks in advance.

share|improve this question
    
Is it set to run regardless if the user is logged in? Also, like MDMarra mentioned, verify which user the task is running under. This greatly impacts the ability of the task to run successfully. What happens if you run the task manually from the GUI? –  MikeAWood Jan 13 '13 at 23:10
add comment

2 Answers 2

By default, scheduled tasks run as SYSTEM. It sounds like SYSTEM doesn't have permission to create the file in the specified location.

You can use psexec -s yourScript.bat to manually run a batch file as SYSTEM to test this with. You can grab the latest version of psexec here.

share|improve this answer
add comment

Specify the Start In location.

enter image description here

share|improve this answer
    
I know this answer is old, but this fixed my issue. I'm not sure if because my batch script is on a different drive (E:) had anything to do with it. Thanks! +1 –  etm124 Mar 7 '13 at 20:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.