Skip to content
⌘ NSIS Forum Archive

How to Edit .reg File

3 posts

dienjd#
You should be able to edit it like you would a text file with FileOpen, FileWrite, FileClose. Make sure there is still valid regedit text at the beginning of the file (example: "REGEDIT4") so that Windows accepts it.

If FileWrite give you errors with a .reg file, write what you want as a .txt file, delete the .reg file, and rename your .txt file to .reg.
Afrow UK#
If you want to edit a .reg file on run time, you'll have to use FileOpen, FileWrite and FileClose. I'm not sure if the registry plugin handles .reg files, but I couldn't find anything to suggest otherwise. FileOpen will have no trouble opening a file with the .reg file extension; after all it is just a plain text file.

If you want to extract a .reg file and edit it on run time before executing it, then it would be much better to use NSIS's ReadRegStr/WriteRegStr (etc) functions which are built in.

-Stu