Skip to content

Instantly share code, notes, and snippets.

@myd7349
Forked from thedom85/timeSync.bat
Created November 21, 2025 03:24
Show Gist options
  • Select an option

  • Save myd7349/9932a777e413080a117b989f3e2187d0 to your computer and use it in GitHub Desktop.

Select an option

Save myd7349/9932a777e413080a117b989f3e2187d0 to your computer and use it in GitHub Desktop.
Rem run as administrator
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on
net start w32time
@echo =============================================
@echo Tell the time sync service to use the changes
w32tm /config /update
@echo =======================================================
@echo Reset the local computer's time against the time server
w32tm /resync /force /rediscover
@endlocal & @goto :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment