Description:
1, if the command can not run, please add chcp 437, or the cmd window to modify the properties of 437;
2, the bat can not be similar to schtasks name, and the bat directory also can not protect schtasks files such as, otherwise it may be the cycle of execution schtasks;
@echo off
NET use \\192.168.5.5\IPC$ "Luke"/user: "Administrator"
for/f "Tokens=7 delims="%%a in (' Net time \\192.168.5.5 ') do (set Dsttime=%%a) & (Goto:next)
: Next
Echo Current server time:%dsttime% >>c:\a.txt
set/a hh=%dsttime:~0,2%
Echo hh=%hh% >>c:\a.txt
set/a mm=%dsttime:~3,2%
Echo mm=%mm% >>c:\a.txt
set/a ss=%dsttime:~6,2%
Echo ss=%ss% >>c:\a.txt
If%ss% geq set/a ss=%ss%-60 & set/a mm=%mm%+1
If%mm% geq set/a mm=%mm%-60 & set/a hh=%hh%+1
If%hh%==24 set/a hh=0
Echo Timed Time:%hh%:%mm%>>c:\a.txt
If%mm% LSS 10 (
Echo is less than 10========= >>c:\a.txt
echo schtasks/create/tn test/tr calc/sc once/st 15:01/f >>c:\a.txt
schtasks/create/s 192.168.5.5/u administrator/p luke/sc once/st%hh%:0%mm%/F
echo minute is less than 10, execution is complete. >>c:\a.txt
)
If%mm% GEQ 10 (
CHCP 437
Echo is greater than 10========= >>c:\a.txt
schtasks/create/s 192.168.5.5/u administrator/p luke/sc once/st%hh%:0%mm%/F
echo minute is greater than 10, execution is complete. >>c:\a.txt
)
Pause