Question

I have a batch file on a Windows 2008 server that, when invoked from command line works fine. However, when I set a scheduled task to run this job, it does not work properly.

The task scheduler does show that that the task is getting run at regular intervals, it does not show any error. But, the batch file does not process what it is supposed to process.

Any ideas on how to fix this issue is most welcome

Was it helpful?

Solution

Windows Server 2008 will not run any batch file with quotation marks " inside the batch file. See http://technet.microsoft.com/en-us/library/dd851678.aspx

OTHER TIPS

I had a similar problem, my .bat file wouldn't correctly execute when I had the full file path in the "Program/script" field.

"D:\path\to\file\somebat.bat" didn't execute. (with quotes)

When I put D:\path\to\file\ (without quotes) in the Start in (optional): field and somebat.bat in Program/script: field somebat.bat executed correctly.

Go figure... not exactly sure why having "D:\path\to\file\somebat.bat" in the Program/script: won't work.

Maybe someone could shed some light on that?

In my case, I had 'Run whether user is logged on or not'. When I changed to 'Run only when user is logged on' it worked OK.

Make sure the task is running under an account with the necessary privileges. When you run a batch script from the command-line directly, it is running under your user account, which may have different permissions than the default account used for scheduled tasks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top