Does your computer turn itself off immediately or at some point before the operating system loads? If so, it could be a short circuit or a serious hardware problem.
Computer turns on and then off (quick fix)
This process can take several minutes to hours, depending on why the computer turns off so quickly after starting up.
Troubleshoot the cause of the beep code, assuming you are lucky enough to hear one. A beep code will give you an excellent idea of where exactly to look for the cause of your computer shutting down.
If this doesn't solve the problem, you can always come back here and continue troubleshooting the problem with the more general information below.