PC turning on and off

bloodmage7

Honorable
Apr 27, 2012
90
0
10,640
My computer suddenly started showing weird behavior: it would turn on for few seconds and then suddenly turn off. By turn on I mean that the CPU, GPU, PSU fans would start and then suddenly stop and it would go on like this.
I read on the internet and Tom's hardware forums, and got the solution that remove the CMOS battery for 10 seconds and insert it again. I did that, suddenly my computer started working normally.
So, my question is that what caused this problem? What does the CMOS battery has to do with it?

My config:
i3 2120
H67 MOBO
8GB DDR3
1TB 7200 RPM HDD
AMD R7 250
Corsair VS 450

Thanks!!