1

How can one export and import a .reg file which contains all keys and subfolders just like the registry editor export function?

I've seen various suggestions and libraries e.g. here.

They only read / write keys by name which doesn't help with many or varying entries. Can it be done using the jna library?

Community
  • 1
  • 1
Bully WiiPlaza
  • 462
  • 1
  • 6
  • 16
  • Probably. Do you have some code yet, or is this speculative? Also, what do you think is in a `.reg file`? – Elliott Frisch Jun 09 '14 at 13:29
  • One can double-click it so that it imports keys to the registry. The content is plain text but there's no need to re-program an interpreter in order to add the contents manually – Bully WiiPlaza Jun 09 '14 at 14:05

1 Answers1

1

You could have it kick off a batch file as indicated here.

set rkey=HKEY_CURRENT_USER\Control Panel\Mouse
REG EXPORT "%rkey%" "C:\keys.reg"
REG IMPORT "%rkey%" newkeys.reg
jcragun
  • 2,060
  • 10
  • 8
  • It won't let one write to the C:\ directory that way but the solution is good, thanks. – Bully WiiPlaza Jun 09 '14 at 14:34
  • @jcracgun isn't that to be put in the command line? How can that be interpreted by java? If I were to write the same command in java that is. – Scarl Sep 24 '14 at 11:04
  • 1
    As indicated, you can put those commands in a `.bat` file and have Java run that batch file. – jcragun Sep 24 '14 at 19:39