Restoring a default file association on Windows 7
You accidentally changed the default program associated with .cmd files to Notepad—how do you change it back?
To undo the file association, open Registry Editor and delete the following key:
Now the next time you double-click on a .cmd file, this reg key will be regenerated and the file association behavior for .cmd will return to its default.
But don't forget Microsoft's warning about directly editing your Registry: "Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk."