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'\"

posted @ 2013-08-01 23:20  dzqabc  阅读(7484)  评论(0编辑  收藏  举报