A year or 2 ago i had this stupid virus that would count down on my screen to the computer shuting then then shut it down and there was nothing i could do to stop it. Everytime i loaded the pc within 5 mins it would count me down to turing off then turn off.
There are anti-virus software out there you can buy to protect your computer. Example: http://www.windowsonecare.com
I've had similar experiences with this error. I would suggest downloading memtest from memtest.org and testing your memory with at least 3 passes of memtest. If you see any errors at all you have bad RAM.
you should try to reformat your computer. or is there an error appearing before shutdown? like blue screen?
Have you looked in the event viewer to see if anything is going wrong at the time of shutdown? I had this problem and noticed an error in some driver software for one of the video cards installed in the computer. Once I updated the driver software, the system stopped rebooting itself. The first clue was that graphics intensive applications were usually when the reboot occurred (Illustrator and Photoshop). Even if you can't pinpoint which piece of hardware is causing the problem, updating your drivers is something you should be doing anyway.
Thanks to all that gave some very useful information. I did have to do a full recovery (re-install Windows) to be able to fix the problem