Hi,
Please do try these troubleshooting steps that may help.
- First is to test you AC adapter if it's supplying enough voltage.
- Remove the battery off the laptop and connect just the AC adapter and see if it will stay on.
- Do also consider trying a different AC adapter that has the same voltage and see if it work or not.
- Another test to determine if it's a hardware problem or software is to load in BIOS and see if the laptop will still shutdown or not.
- If it will not shut down I would suggest reinstalling Windows first.