预期今天中午将自动备份;
仔细检查了下代码:
schtasks /create /tn "Back Gosstech" /tr D:serverBackgosstech.bat /sc daily /mo 7 /st 12:00:00
按照schtasks API st 表示startTime 但是我写入这个任务的时候实际上过了当天的12点所以,当天没有执行正常;
附:遇到这个疑问时候,打算查查这个任务;
schtasks /query
一直提示无法加载资源;
查了一些资料;由于编码问题;解决方案:
cmd chcp 如果return 936表示GBK码;
直接chcp 437 打开另外一个窗口就行了;
Active code page: 437 C:UsersAdministrator>schtasks /query Folder: TaskName Next Run Time Status ======================================== ====================== =============== Back Gosstech 2015/8/17 12:00:00 Ready WpsNotifyTask_Administrator 2015/8/14 16:09:00 Ready WpsUpdateTask_Administrator 2015/8/14 16:09:00 Ready
表示我的任务是正常的;
查看任务详情;schtasks /query /tn "Back Gosstech" /fo LIST /v
C:UsersAdministrator>schtasks /query /tn "Back Gosstech" /fo LIST /v Folder: HostName: 114-20150407DXK TaskName: Back Gosstech Next Run Time: 2015/8/17 12:00:00 Status: Ready Logon Mode: Interactive only Last Run Time: N/A Last Result: 1 Author: Administrator Task To Run: D:serverBackgosstech.bat Start In: N/A Comment: N/A Scheduled Task State: Enabled Idle Time: Disabled Power Management: Stop On Battery Mode, No Start On Batterie s Run As User: 114-20150407DXKAdministrator Delete Task If Not Rescheduled: Enabled Stop Task If Runs X Hours and X Mins: 72:00:00 Schedule: Scheduling data is not available in this f ormat. Schedule Type: Daily Start Time: 12:00:00 Start Date: 2015/8/10 End Date: N/A Days: Every 7 day(s) Months: N/A Repeat: Every: Disabled Repeat: Until: Time: Disabled Repeat: Until: Duration: Disabled Repeat: Stop If Still Running: Disabled
Last Run Time: N/A
表示还没有执行过一次;所以;静候;