我使用schtasks
实用程序在Windows-XP上安排了一项任务,但该任务未运行。以下是我在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 In
列在schtasks /query /v
的输出中的含义是什么?
谢谢!
答案 0 :(得分: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 ...