Windows keeps a regular backup of the Registry in case of these situations. By default, the RegIdleBackup task runs every 10 days. So - if you didn't make a backup, you'll at least be able to restore from that point. You can find the backed up registry in..
\Windows\System32\config\RegBack
To replace the registry however, you can't be running your installed copy of Windows at the same time. You'll have to boot to the recovery partition of Windows 8 and use the Command Line Interface.
Here are the steps...boot to the command line by holding shift while you reboot as explained here...http://www.howtogeek.com/126016/three-ways-to-access-the-windows-8-boot-options-menu/ And select "command prompt."
Then type/run this command...