设置定时任务 @echo off set NAME=dailybackup set TIME=20:01:00 set DAY=MON,TUE,WED,THU,FRI,SAT,SUN set COMMAND=cscript.exe %~dp0dailybak.vbs %SystemDrive% cd %windir% asks if exist %NAME%.job del %NAME%.job schtasks /create /tn %NAME% /tr "%COMMAND%" /sc weekly /d %DAY% /st %TIME% /ru system
在含有看空格的参数或则路径前面加上 " 进行转义,这样就ok
demo: schtasks /create /sc minute /mo 30 /tn "finaltest" /tr ""d:program filesmth.bat"" "'20' '302'"