There are two (2) main reasons that can cause a computer to turn off:
1 - Faulty power supply. Usualy quick as less than a minute. In many cases, it will turn off before you get to Windows. It may be to quick to finish the POST check-> NO beep.
2 - Overheating. It normaly takes a few minutes.
If it's the power supply, you need to change it.
If it takes over a minute before turning off, you need to dust off the computer starting with the CPU heat sink.
A very badly configured computer may shut down, but it's extremely rare. It can appen if you have a startup item that asks to turn off the computer.
Start in safe mode and remove the offending startup item.
Electro
June 2011