我需要在PC上更改时间以调整任务调度程序运行的夏令时更改,因此,我制作了这个小批处理文件,我需要知道该代码是否正确,因为我觉得有些内容正确无误该
当我将它与打印时间ECHO Current Time is %TIME%
备注
Pwoershell
windows 7
,XP
和windows server 2003
提前感谢您的帮助
@ECHO OFF
TITLE Daylight Saving
SET CurrentHours=%TIME:~0,2%
ECHO.
ECHO Current Time is %TIME%
REM ECHO %TIME:~0,2% REM --- Hours
REM ECHO %TIME:~3,2% REM --- Minutes
REM ECHO %TIME:~6,2% REM --- Seconds
REM ECHO %TIME:~9,3% REM --- Milliseconds
if %CurrentHours% LSS 23 SET /a CurrentHours=%CurrentHours%+1
if %CurrentHours% EQU 23 SET CurrentHours=00
TIME %CurrentHours%:%TIME:~3,2%:%TIME:~6,2%.%TIME:~9,3%
ECHO.
ECHO Time has been adjusted for Daylight saving changes.Current time now is %TIME%
PAUSE
REM --- EXIT
答案 0 :(得分:0)
Windows具有以下功能:“禁用Windows时钟到DST的自动更新设置。”然后你不必在凌晨2点起床手动完成。这个网页教程详细解释了它。
http://in5stepstutorials.com/windows-7/prevent-automatically-changing-windows-time-to-dst.php