Synchronize Internet Time in a Windows script?
See the reference for W32tm, "A tool used to diagnose problems occurring with Windows Time": http://technet.microsoft.com/en-us/library/bb491016.aspx. Also, w32tm /?
Use w32tm /resync
. You may also need to set a server with net time
if you haven't done that yet.
@echo off
net start W32Time
w32tm /resync
echo sync complete
- Copy this code to Notepad and save it as a
.bat
file. - Run the batch file with Administrator privileges or schedule a task to run this batch file from the Task Scheduler, as required.
Note: This required Administrator privileges and a working Internet connection.