Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

export registry keys/sets to a file?


4 replies to this topic

hans_vdc

hans_vdc
  • Members
  • 3 posts

Posted 18 May 2004 - 10:08

Is there an easy way to export a bunch of registry keys into a .reg file. I need to create a setup for an update but I would like to write a 'backup' of the registry keys onto a file in the application directory. It's not enough to put the keys in memory, I really need to put them in a file too

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 18 May 2004 - 12:49

I did this once, but I don't have the code here right now. You basically call regedit.exe with the /e command line, and then specify a file to export to. I think I had this implemented as a backup of user settings, and I think I wrote it to MyDocuments with a file name and a time/data stamp in the file name.

regedit.exe /e c:\export.txt "HKEY_LOCAL_MACHINE\SOFTWARE\YourCompany\YourApp\"
Regards
-Stein Åsmul

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 18 May 2004 - 13:50

Cool. I always wondered if one could export registry settings from the command line, so thanks Glytzhkof. This will come in handy.
user posted image

hans_vdc

hans_vdc
  • Members
  • 3 posts

Posted 18 May 2004 - 14:40

Managed to get it working in my installshield project. Though I'd post it here, could be useful to other people too (don't mind the few dutch words, I'm from belgium)

function exportreg()
STRING deel1,deel2,deel3;
begin
deel1 = WINDIR ^ "regedit.exe";

//dline.exe onder app paths
deel2 = "";
deel2 = "/e /s ";
deel2 = deel2 + TARGETDIR ^ "regbackup1.reg";
deel2 = deel2 + " " + "\"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\dline.exe\"";
LaunchAppAndWait (deel1 , deel2 , WAIT);
end;

Edited by hans_vdc, 18 May 2004 - 14:41.


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 19 May 2004 - 08:14

Thanks for that follow up hans, good reference. I think the function I created was very generic. I think I will forward this to Stefan when I get access to it. Might be useful for someone, and it is always a shame to have people write the same damn code over and over.
Regards
-Stein Åsmul