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"