@Invu
I would recommend doing these in safe mode if you can't do these tasks without your pc restarting on you... or you can try this, Open "System" > click on Advanced system settings > Advanced tab > Startup and Recovery > Settings. Uncheck the Automatically restart box, click apply. Here are some other things I would suggest.
1: See how much of your ram and cpu is being used via the task manager, and see if anything is overheating
2: Scan your pc for any malware or viruses via an antivirus
3: See if all of your computer drivers are up to date, like for example make sure the BIOS is updated to the latest version if it isn't already
4: Check the event viewer to see if there is any "Kernel" errors or any reboot errors
5: Try a system restore, pretty much what system restore does is revert your computer back to a previous point in time. It can be used to resolve a multitude of problems with your computer, but it can't solve an actual hardware issue
6: Reinstall windows (as a last resort)