Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Key1\SubKey1]
"PathKey1"="C:\SomeFolder\SomeSubFolder\SomeExecutable.exe"
When I ran it on my PC to verify it's working I saw it created the keys all the way to the "SubKey1" but the string value PathKey1 wasn't added.
Can you say what the problem was?
I wasn't sure as well. Then I've found you have a nifty little menu option in registry that says "Export" and it will create the reg file for you.
I ran it and out of curriosity I opened the file in Notepad to see what was I missing.
The thing is that RegEdit want to have the "\" escaped with another "\" so the successfull reg file will be:
[HKEY_CURRENT_USER\Software\Key1\SubKey1]
"PathKey1"="C:\SomeFolder\SomeSubFolder\SomeExecutable.exe"
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Key1\SubKey1]
"PathKey1"="C:\\SomeFolder\\SomeSubFolder\\SomeExecutable.exe"
The catch here is that no matter RegEdit won't be able to create the String value it will tell you that it succeeded.
I will most probably never use to manually add things in Notepad, I'll use Regedit Export functionality now that I know it but be sure to always check that paths added to the registry via .reg file are double escaped.
Hope this helps.
[HKEY_CURRENT_USER\Software\Key1\SubKey1]
"PathKey1"="C:\\SomeFolder\\SomeSubFolder\\SomeExecutable.exe"