Hi @Cindy29,
Welcome to HP Forums, this is a great place to get support, find answers and tips.
Thank you for posting your query, I'll be more than glad to help you out.
I understand that your laptop does not turns for a few second and then shuts down.
Let’s start with the below steps:
Perform a hard reset click here for details
If the computer still turns off every few seconds, try with an alternate adapter and/or remove the battery and try turning on the computer without the battery,
Only connect the adapter and start.
Also, let us know the model number of the unit.
Let me know how this works.
You have a good day ahead.
Rainbow23
I am an HP Employee
If you found this post helpful, you can let others know and also show your appreciation by clicking the “Accept as Solution” button, “Thumbs up" button!