Write a batch file to update system time


I am looking for a batch file that will update my system time to the time at time.windows.com I don't really know how to write a batch script, but I do know how to copy and paste the text into a time.bat file. : )

I have been trying things like:
net time /set
net time /setsntp:time.windows.com

Those don't work. PLease help!


Who is Participating?

Improve company productivity with a Business Account.Sign Up

perlgeekConnect With a Mentor Commented:
You almost got it. Try this:
net time /setsntp:time.windows.com /set /y

/set sets the time, /y turns off prompt

For a list of Time servers go to http://www.boulder.nist.gov/timefreq/service/time-servers.html
Small addition about "time to time"
It is needed to add several time to .bat

at 9:00 net time /setsntp:time.windows.com
at 12:00 net time /setsntp:time.windows.com
at 15:00 net time /setsntp:time.windows.com
at 18:00 net time /setsntp:time.windows.com

and include this .bat to Autostart folder
ekrinerAuthor Commented:

Thanks for your answer, sorry it took so long to reply, but I have had one of those weeks! Your answer is much appreciated!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.