Saturday, March 1, 2014

How I fixed the CMOS baterry time & date issue

As CMOS battery in my PC got rotten my system won't boot, unless I press F1. Then I try to access the internet, Google wont open as it sights security risk! that's the first time I realized my PC date & time is getting reset to 01-01-2004 12:00:00 AM cause of this battery problem.

The simplest way to fix this would have been to replace the battery. But I'm really afraid to touch anything in my decade old PC as it is running on the power of Karma not by the virtue of power cord. So I was using it as such like pressing F1 every time to boot and then later setting the time using the clock. Slowly this boring ritual started to irritate me and then I thought "hey I'm a techie let me find some good way".

Automation it is! The only development work I do in my office is when I get a work item on "automation". So I simply wrote a 5 line batch script and placed it in the start up. Now when Desktop opens a Command window pops up asking "enter time and date" cool ah! watch the picture here. >

@echo off
echo "Enter time as hh:mm:ss AM/PM eg. 07:53:06 AM"
echo "Enter date as MM-DD-YYYY eg. 12-31-2013"

The code is for Windows XP check this wikihow entry for other OS.