Last active
October 8, 2021 06:52
-
-
Save Fiaxhs/61aa9b7d9ea69e94a2c9 to your computer and use it in GitHub Desktop.
Force date and time internet sync - Windows bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Create a bat file with the following 4 lines (feel free to change ntp servers below) | |
w32tm /config /syncfromflags:manual /manualpeerlist:"ntp.unice.fr, ntp.accelance.net" | |
net start w32time | |
w32tm /resync | |
w32tm /resync | |
REM Yep, often the first time fails, just do it again. | |
REM Save as .bat file, and create a scheduled task at each logon. | |
REM - You can do this with Task Scheduler by hand, be sure to tick "Run as administrator" | |
REM - Or open a command as administrator and enter this: | |
REM schtasks /create /sc onlogon /tn ForceSyncTime /rl highest /tr "C:\your\path\to\your\file.bat" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How i can use this command in batch file
schtasks /create /sc onlogon /tn ForceSyncTime /rl highest /tr "C:\your\path\to\your\file.bat"