window系统自动设置时间同步脚本
脚本如下:每小时同步一次
@echo off echo autor OAK @echo off echo -------------------------------- @echo off echo setup time resync every one hour @echo off REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /v SpecialPollInterval /t REG_DWORD /d 3600 /f @echo off echo -------------------------------- echo setup w32time auto startup @echo off REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time /v Start /t REG_DWORD /d 2 /f @echo off echo -------------------------------- @echo off set /p TimeServer=Please Input The Time Server IP: net time /setsntp:%TimeServer% net stop w32time net start w32time w32tm /resync
设置定时执行
打开windows桌面左下角的开始菜单,点击右侧"控制面板",在接下来的控制面板项中找到“管理工具"并打开,在管理工具菜单菜单中找到“任务计划程序”并双击打开。
然后设置对应的执行条件来触发程序的执行