You need to figure out why it is shutting down and fix that before trying to fix windows -- Hardware problems need to be fixed before software can be worked on !! Is it a power supply issue - a HDD problem - a memory problems - etc. until you know what is causing the shut down it will not do any good to try and repair windows.
wanjiku luicer said:
how do you restore windows if your computer shuts down
JDFan is absolutely correct. However, your question was "How to restore", and I gave you the options.