2

我使用实用程序在 Windows-XP 上安排了一项任务schtasks,但该任务没有运行。这是我在SchedLgU.Txt日志文件中看到的内容:

"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.

我发现此错误的原因是脚本路径中的空格。我用来设置任务的命令如下所示:

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

例如,如果我用下划线替换空格,问题就会消失。

我该如何解决这个问题?

还有一个问题:列在输出中
的含义是什么?Start Inschtasks /query /v

谢谢 !

4

1 回答 1

6

我找到了答案:

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.

即它应该是这样的:

schtasks /create /tn "MySQL Automatic Backup" 
         /tr "\"d:\path with spaces to my script\my script.bat\"" /sc daily ... 
于 2010-10-02T13:39:34.887 回答