|Try entering the BIOS (setup) screens. If the computer then continues to run the likely cause is either a corrupted Windows installation or one or more hardware components may have a problem or have failed.|
If you can't get the computer to stay on in the BIOS then the likely causes are overheating or power supply. Open the case and look to see how dusty/dirty it is inside and if all fans are rotating fast.
If cleaning is needed (likely), DO NOT use a vacuum cleaner. Use canned or compressed air to blow out everything including both ends of the power supply. This will be messy so you may want to move the tower to another location.