Check the case button, sometimes having a stucked power button will force shut down the PC in the first few seconds.
If this is not the problem, check VGA fan and swap RAM may be helpful.
Also check for the capacitor on the mobo for any expanded, damaged or leaked capacitor.
Hope this helps!
Bill
There are many ways to automatically shutdown your pc.
1. First make sure that the interval between or during and after system restarted is 10 second is fixed or randomly shutdown time.
2. If it restarted in or between 10 second then make sure that your Hard is infected by Virus.
3. Scan your whole drives or Hard Disk and try to remove viruses.
4. one of the best way to to resolve this issue is backup all your data on to any available Hard drive or external Hard drive. and try to format whole partitions and hard drive.
5. try to start Your computer in with Safe-Mode and then run Smith fraud fix or AntiSPyware or AVG 8 to remove viruses. if any one of these antiviruses detect virus then continue to scan and when scanning completed try to Reboot your computer in Normal Way.
6. the again and again rebooting means that your system is infected by viruses and the sometimes memory problem