views:

19

answers:

1

I scheduled a task on Windows-XP using schtasks utility, but the task does not run. Here is what I see in the SchedLgU.Txt log file:

"MySQL Automatic Backup.job" (WampServer) 10/2/2010 6:36:43 PM ** ERROR **
Unable to start task.
The specific error is:
0x800700c1: (Unable to find an error message)
Try using the Task page Browse button to locate the application.

I found out that the reason for this error is spaces in the path to my script. The command that I used to set up the task look like:

schtasks /create /tn "MySQL Automatic Backup" 
         /tr "d:\path with spaces to my script\my script.bat" /sc daily ... 

If I replace the spaces with underscores, for example, the problem disappears.

How could I solve this problem ?

And another question:
What does the Start In column means in the output for schtasks /query /v ?

Thanks !

A: 

I found the answer:

Spaces in file paths can be used by using two sets of quotes, 
one set for CMD.EXE and one for SchTasks.exe. 
The outer quotes for CMD need to be double quotes; 
the inner quotes can be single quotes or escaped double quotes.

i.e. it should be like this:

schtasks /create /tn "MySQL Automatic Backup" 
         /tr "\"d:\path with spaces to my script\my script.bat\"" /sc daily ... 
Misha Moroshko