I have a batch file and a corresponding task entry set up for it- and when I manually run the .bat file, it runs just fine- but the task scheduler doesn't execute the .bat file properly.

I believe I set up the task correctly. The "Security options" are properly set up, the trigger is accurate, and the Action has the following parameters:

  • Action: "Start a program"

  • Program/script: "C:\foo\Command Line Utility\TopSecretProject\desiredscript.bat"

  • Add arguments (optional): desiredscript.bat (tried with and without this)

  • Start in (optional): C:\foo\Command Line Utility\TopSecretProject\ (tried with and without this)

When looking at the history, I see that the task was triggered, the task engine received the message to start the task, the action was started, the task was started, the task process was created, and 36 seconds later, the action and task were completed.

However, the task normally takes about 1-2 minutes to run when the batch file runs normally; incidentally, the expected output of the batch file isn't realized.

My question: how can I troubleshoot this further? Does the very short run time tell us anything beside that something in the Task Scheduler isn't running properly?

Additional details:


  • "Allow task to be run on demand" is checked;
  • "Stop the rask if it runs longer than: " is set to 3 days
  • "If the task is already running, then the following rule applies: " is set to "Do not start a new instance"


  • "Run whether user is logged on or not" is checked; correct password was entered
  • "Run with highest priviledges" (tried with and without this checked)
  • Look in the event viewer for any errors – DavidPostill Nov 1 '17 at 17:11
  • 1
    Would help to see the actual script or if you get the same problem with a very basic batch file. – Squashman Nov 1 '17 at 17:16
  • 1
    Thanks for editing, but you're not helping us out here. There are very real implications about WHAT user you are using to run the script, and WHERE the script is located in regards to permissions. If "foo" is any restricted folder like C:\Users or C:\Windows etc. then whatever user you are using to run the script better have full access to that folder. – Appleoddity Nov 1 '17 at 17:35
  • 1
    If your script uses the network, make sure you know theimplications of running it via a scheduled task. – Eugen Rieck Nov 1 '17 at 17:54
  • 1
    Check Last run result in Task Scheduler. Try Program/script: C:\Windows\System32\cmd.exe and Add arguments (optional): /C ">>somefile.txt 2>&1 "C:\foo\Command Line Utility\TopSecretProject\desiredscript.bat"". Run the task,and then check somefile.txt (use fully qualified path with write rights). – JosefZ Nov 1 '17 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.