0

I want to edit .reg file, before importing it by using batch script. Content of .reg file given below.

[HKEY_LOCAL_MACHINE\SOFTWARE\SomeSoftware] Resource=RESOURCE_FOLDER/images

There are many keys like this in the file. Here I want to replace RESOURCE_FOLDER with any directory path (like C:\Program Files\SomeSoftware\resource), which depends on user input. For importing .reg file following command can be used

regedit.exe /s path of .reg file

Can we provide arguments to this command which takes RESOURCE_FOLDER value ? or any other way to do this ?

sagar
  • 1,900
  • 5
  • 30
  • 45
  • 1
    On using default export a .reg file is a UTF-16 encoded Unicode file with BOM containing in first line `Windows Registry Editor Version 5.00` which is hard to modify in command line environment. But choosing on export `Win9x/NT4 Registration Files` in `Save as type` results in getting a .reg file being encoded in ANSI with first line being `REGEDIT4`. Such a single byte per character encoded .reg file is very easy to edit within a command line. `regedit.exe` imports both registry file types. So I suggest to use version type 4 for the .reg file. – Mofi Jun 03 '15 at 13:37
  • 1
    For the replace in ANSI encoded .reg file with first line being REGEDIT4 see [How can you find and replace text in a file using the Windows command-line environment?](http://stackoverflow.com/questions/60034/) – Mofi Jun 03 '15 at 13:41
  • @Mofi : Will version type 4 work on Windows 8 ? – sagar Jun 03 '15 at 13:46

0 Answers0