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 !

link|improve this question

feedback

2 Answers

What command have you set for the task?

link|improve this answer
The command is: schtasks /create /tn "MySQL Automatic Backup" /tr "d:\path with spaces to my script\my script.bat" /sc daily .... I found out that the problem is the spaces in the path to my script. Any idea for a workaround ? – Misha Moroshko Oct 2 '10 at 12:41
feedback
up vote 0 down vote accepted

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 ... 
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.