Sync Time in Windows with NTP Server using Command Line Interface

Every desktop computer keeps the correct time even when it is turned off by using a simple 3V Lithium battery cell (CR2032). But this is not a rechargeable battery cell, so it stops working after a year or so. You can easily replace this cell, but after replacing the cell, you have to update the time using the NTP servers so that your Windows PC keeps the accurate time. You can update the time using Windows graphical user interface and also through a command line interface (CLI). The CLI method works even when the time service is not properly configured in Windows.

Here is how you can sync time with NTP servers in Windows using the command line interface:

  1. Open an elevated command prompt. In Windows 8 and later versions, you can press the hotkey Win+X and choose Command Prompt (Admin) from the menu that shoes up. For earlier versions of Windows, you can search our side about opening elevated command prompt in Windows.
  2. In the elevated command prompt window, type the following commands. At the end of each line, press Enter to issue that command:
    w32tm /register
    sc start W32Time
    w32tm /config /update /manualpeerlist:”pool.ntp.org”

    Windows Time Sync Command Line

  3. These commands will register Windows Time service if it is not registered for some reason, start this service, change the time server to “pool.ntp.org” and finally sync the computer time with the NTP server. Obviously, instead of “pool.ntp.org”, you can change the time server to any time server of your choice.>

You can also download update-time-windows.zip, extract the contents to Windows desktop, right-click on update-time-windows.cmd and choose Run as administrator. This will automatically run a batch file containing all the necessary commands for syncing the time.

Windows Time Sync Command Line

Conclusion: Using command line interface or a batch file to sync the Windows PC time with a remote NTP server can be useful when you have to update it frequently. The reasons for frequent syncing could be a failing battery or dual boot operating systems having different time zones set.