Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I synchronize a windows PC time to a NTP server using a batch script?

share|improve this question

You can use the Net Time command to do this:

Net Time /

This will set your machine to use the external server specified for its time server.

If you wish to set the machine to use an internal time server, you can use this command:

share|improve this answer

If you wish to use NTP you should really use it properly and install an NTP daemon. It will try keep your clock in sync using regular clock skew rather than jumping it at arbitrary times.

You can get a good Windows port of the standard NTPD from here.

share|improve this answer

You don't need to use a batch script.

See my answer here for some info on NTP in Windows.

share|improve this answer

If you have AD you don't need to do this, so long as the client is properly set up (i.e. no time server is set) it will automatically sync with the doamin hierarchy.

If you don't have AD you need to look at the NET TIME or W32TM commands.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.