本帖最后由 栤樰 于 2024-3-15 17:14 编辑
每10分钟同步一次,如果不能自动同步需要手动去同步一次以后就可以自动同步
- @Echo Off
- cd %systemroot%\system32
- call :IsAdmin
- Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" /ve /t REG_SZ /d "0" /f
- Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" /v "1" /t REG_SZ /d "time.windows.com" /f
- Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" /v "2" /t REG_SZ /d "time.nist.gov" /f
- Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" /v "0" /t REG_SZ /d "cn.ntp.org.cn" /f
- Reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v "AnnounceFlags" /t REG_DWORD /d "5" /f
- Reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v "NtpServer" /t REG_SZ /d "cn.ntp.org.cn,0x9" /f
- Reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" /v "Enabled" /t REG_DWORD /d "1" /f
- Reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" /v "SpecialPollInterval" /t REG_DWORD /d "600" /f
- Reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" /v "SpecialPollTimeRemaining" /t REG_MULTI_SZ /d "cn.ntp.org.cn,0" /f
- ping 127.0.0.1 -n 3 >nul
- sc config "W32Time" start=Delayed-auto
- ping 127.0.0.1 -n 1 >nul
- sc start "W32Time"
- Exit
- :IsAdmin
- Reg.exe query "HKU\S-1-5-19\Environment"
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
复制代码
|