turn off automatically restart for a system failure in "control panel"-"system"-"advanced"-"startup and recovery" This will stop your computer from restarting if windows thinks of low memery remaining is a system failure and restarts automatically.
But this will NOT solve your blue screen problem if you have hardware problem like 單身老貓 mentioned.
But this will NOT solve your blue screen problem if you have hardware problem like 單身老貓 mentioned.