Windows7 comes with a handy feature to allow you to take a complete image of your computer. This image contains everything on your computer and if used to restore it will restore everything on your computer, including Windows, Files, Settings etc to the point at which the backup image was created.

Whilst this can be used to protect you against a hard disk failure the more common scenario is your computer gets infected with some kind of malware or virus that damages windows so badly the only option is a rebuild.