I had one pc do that to me. I was told it was one of these problems-
Bad power switch
Bad power box
Bad internal battery
or
could just have too much dust in it, as some dust will conduct electricity and make a "short" in the system.
I replaced my internal battery and the switch, but it didnt do any good.
I just went and got another pc instead of having to play guessing games with all the "if's", "ands", or "buts" that could be going on with it.