一键开启NTP服务,时间同步服务端。
测试平台:win7/win10
批处理代码:- @echo off
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v "AnnounceFlags" /t REG_DWORD /d 5 /f
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" /v "Enabled" /t REG_DWORD /d 1 /f
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" /v "Type" /t REG_SZ /d "NTP" /f
- netsh advfirewall firewall add rule name="_123 NTP" protocol=UDP dir=in localport=123 action=allow
- net start w32time
- netstat -an | find "123"
- pause
复制代码
|