Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a task to the windows task scheduler, but the path for my .exe is in a directory with spaces so it cannot find the file. It gives me an error of "could not start" and in the log it shows "cannot find the file specified". If I manually edit the "Run" location to place the full path in quotes then it works fine. However, I need to be able to add the tasks via command line because I'm running the command as part of a .NET installer. Any ideas how I can accomplish this?

Here is the command I'm running:

C:\> schtasks /tn "My Utility" /sc daily /st 00:00:00 /ru System /tr "C:\Program Files\My Folder\some.exe"

This adds the task fine but the run location ends up being:

C:\Program Files\My Folder\some.exe

-- rather than --

"C:\Program Files\My Folder\some.exe"
share|improve this question
up vote 1 down vote accepted

The command you listed in your posting fails with a command syntax error.

Running the command below on a Windows XP SP3 machine works for me (when I create a folder named "C:\Program Files\My Folder" and put an EXE in that folder named "some.exe"):

schtasks /Create /tn "My utiltiy" /sc daily /st 00:00:00 /ru System /tr "\"C:\Program Files\My Folder\some.exe\""

Escaping the double-quotes seems to do the trick.

share|improve this answer
Thanks. I had just found the KB article to do just that. Here it is in case anybody else runs across this issue: – Taylor Leese Feb 26 '10 at 2:55

Your Answer


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.