1

Cmos battery dead with wrong time/date cant fix it at the moment

In the time being I want a batch file to change the system date and time to current as a start up task

But if the date/time is wrong on start up then i want it to get the correct one from another pc on the network if this is possible from the ip address.

2
  • Depending on your OS you should be able to force internet time synchronisation during boot-up, using an NTP client or by analysing the response from cURL on an internet site which displays the date and time, such as timeanddate.com, or even from your router. If any of the machines has a web server you can format your own page showing the date and time. But you may not be able to guarantee that this will run before the launch of other programs and services which require a correctly set clock.
    – AFH
    Jul 13, 2015 at 12:12
  • It should be sufficient to install ntpdate (making sure that it points to servers you can see on your network). It gets invoked pretty early in the boot sequence, so you should see only a few lines of syslog with the wrong date-time. Jul 13, 2015 at 12:14

1 Answer 1

0

Put this batch to startup or scheduler

@echo off
net time \\pc_name_or_IP /set /y

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .