Monday, July 20, 2009

Windows Schedule Jobs won't run if path has special characters - solved

While trying to trouble shoot an issue with a scheduled task on a Windows 2003 server I found a few interesting things to keep in mind.

1. Windows XP machines have the windows scheduler log file located under c:\windows\SchedLgU.Txt - This is not the case with Windows 2003 server. To view the log file on a Windows 2003 server run the following command %SystemRoot%\Tasks\SchedLgU.txt
2. If you attempt to call a batch file from your scheduled job that is under a path name that includes a special character like the ampersand (&) it will not run. You will need to move your batch file into a folder that does not have the ampersand anywhere in the path.

Here is an example:
c:\a&b\batch-file.bat - this file will work if you double click the file in Windows explorer, but it will not work as a scheduled task.
move the file to a folder without an &:
c:\batch-file.bat - This file will now execute properly as a scheduled task.

According to this link the reason is that a windows cmd will process as a separation of two commands. So the scheduled task trys to run 'c:\a' and also 'b\batch-file.bat'. Neither of these files exist, so the scheduled job will not run.

No comments:

iPod Touch Deals