Running a simple batch file at startup

S

samah

The CMOS battery is gone bad in my Windows XP machine.

Whenever Windows starts, I want to run the 'Date' command to set the
current date. How do I accomplish this?

Thanks in advance.

-samah
 
K

Ken Blake, MVP

The CMOS battery is gone bad in my Windows XP machine.

Whenever Windows starts, I want to run the 'Date' command to set the
current date. How do I accomplish this?


Why don't you simply want to replace the battery? It's easy to do and
extremely inexpensive (two or three US Dollars).
 
A

ArameFarpado

Em Quinta 19 Novembro 2009 01:11, samah escreveu:
The CMOS battery is gone bad in my Windows XP machine.

Whenever Windows starts, I want to run the 'Date' command to set the
current date. How do I accomplish this?

Thanks in advance.

-samah

a bat called from the start menu folder would do...

but why don't you sincronize your clock with an ntp server?
 
S

Shenan Stanley

samah said:
The CMOS battery is gone bad in my Windows XP machine.

Whenever Windows starts, I want to run the 'Date' command to set the
current date. How do I accomplish this?

Why don't you simply want to replace the battery? It's easy to do
and extremely inexpensive (two or three US Dollars).

Agreed. Get the battery.

<begin batch - copy BELOW this>
date
time
<end batch - copy ABOVE this>

Save as a filename.cmd file and create a shortcut to it in your startup
folder. (filename can be whatever you want.)

Although - your clock should synchronize with some time server *if* you have
Internet on said computer - as long as it is on and connected.

However - best solution, again, is to purchase and replace the battery.
 
S

samah

samah said:
The CMOS battery is gone bad in my Windows XP machine.

Whenever Windows starts, I want to run the 'Date' command to set the
current date. How do I accomplish this?

Thanks in advance.

-samah

Thank you all for your guidance. I am using the bat file as a temporary
solution for a few days only. Definitely I would go for a battery change
as soon as I can.

Thanks & best regards

-samah
 
V

VanguardLH

samah said:
Thank you all for your guidance. I am using the bat file as a temporary
solution for a few days only. Definitely I would go for a battery change
as soon as I can.

Thanks & best regards

-samah

What you may not know is that the hardware clock (for which the wafer
battery is a backup to the RTC and CMOS) is *only* used when the
computer is booted up to the POST screen. When the OS loads, it uses
its own clock and not synchronized to the hardware clock. That means
the hardware clock may be accurate (to a couple minutes per year) but
the OS clock can get way off if program(s) consume so much resources
that time slices cannot be allocated to the OS clock to get it updated.
While Windows comes with its time service, it syncs to Microsoft's time
server (although you can change it to use the NIST service, or add more
servers in a registry key so you can select from one of them). Yet it
can be a week, or more, before the time service decides to sync your OS
clock to one of the NTP (network time protocol) servers that sync to the
atomic clock. You might want to start looking at a 3rd party time sync
utility. I use Socketwatch (not free) because it figures out from its
list of worldwide servers which one has the least latency. The
physically closest NTP server may not have the least latency over the
network. There are free time sync utilities (I installed one on my
aunt's host but can't remember what it was anymore).

Even if the hardware clock is off (because of a dead battery), the time
sync utility will update the OS clock. So after the OS loads, and after
a time sync, your OS clock is on time despite the dead battery.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top