bat設置windows計劃任務

設置定時任務
@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%\tasks\
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 file\smth.bat\"" \"'20' '302'\"spa

相關文章
相關標籤/搜索