Avatar of arunykand
Flag for United States of America asked on

Setting Windows Time and Date

I have two computers one running WinXP (Machine-A), which is a stand-alone (no keyboard/mouse, but has a 8 button joystick & monitor) and another is a laptop running Win7 (Machine-B).  

Typical execution is, WinXP boots up and runs a custom software and when required, the Win7 laptop connects to the WinXP machine via cross over cable and access a network share to download some files to the laptop.  

The issue we are running into is, the CMOS battery on the WinXP machine is dying and reverting the system time to some date in 2011.  With this issue present, when the Win7 machine tries to access the fileshare on the XP machine, it fails.  For the longest time, I used to think this was a username/password issue, but it is directly related to the time difference between the two machines (If we manually make one match the other, the file share works like a charm).  

So now onto my question:  I can see two options for me to fix this:

1 ) try to do a 'net time' from the XP machine to get the time from the Win7 machine when it is hooked up and set it's time to the correct time.  (This might not work due to security policies, I need to check)

2).  Modify my software on the XP machine to enter a time/date manually (Via joystick, i'll have to figure out how to do this) and set that time for Windows.  

Can you please tell me how (Again, i'll figure out how to get the user to input the time via the joystick) to take the time in 'HH:MM AM/PM' and  date in 'MM/DD/YYYY' format and set it for Windows time?  I am using C++, so code snippets on how to accomplish this will be very helpful.  BTW, I do have psexec available on both PC's but I am not sure I can guarantee that the 'time' & 'date' commands via psexec will work 100% of the time, so that's why I figured having the user enter the time manually will be the best approach

Thanks so much!
Windows XPWindows 7Internet ProtocolsC#

Avatar of undefined
Last Comment

8/22/2022 - Mon
Scott Fell


I am pretty sure that remote desktop/assistance is disabled on the XP side for security compliance issues :(

>>  the CMOS battery on the WinXP machine is dying   <<  then the easiest solution is to replace the battery; it is a CR2032 coin type battery, supplying 3V and costs about 3-4$
5 minutes work to replace the battery, and set the bios right
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

Replacing the battery is cheap, but not what the customer wants. I am looking to fix the software so that even if the battery died there will be a backup solution. Any help to implement this via software??

>>  Replacing the battery is cheap, but not what the customer wants  <<   if his cars is out of gas, he may want what he likes, but in order to run, he 'll need gas
here's the same : replace the battery

I am not arguing about replacing the battery. I just need to figure out how to set the time via C++ as I had requested in my original post! If someone can help me that would be great
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

i agree - but if the battery is low,  other settings will change, or vanish, or be reset
how will you cope with these then?
that is why i suggest there is only 1 true solution : a new battery

Like I said before I am not disagreeing with you but the change is requested from management not me. I think we will be doing both changing the battery as well as updating the source code as a fail proof way. If you could please point me the right direction has to how to change a time from C++ it would be great thank you

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thanks for your help Nobus
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

glad to help where i can - i hope someone comes in that can help you better than me
and plse - don't  assign points, unless it helps you