Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Registry Export Import Regedit /E
; Registry Export/Import Functions ; Les Ferch, April 11, 2008 #DefineFunction RegExport(RegHandle,Key,File) ItemList = RegQueryItem(RegHandle,Key) ValueCount = ItemCount(ItemList,@TAB) ValueCount = ValueCount + 1 For i = 1 To ValueCount Item = ItemExtract(i,ItemList,@TAB) KeyVal = Key:"[":Item:"]" If RegExistValue(RegHandle,KeyVal) Type = RegEntryType(RegHandle,KeyVal) TypeOK = Type==1 || Type==2 || Type==3 || Type==4 || Type==7 || Type==11 Terminate(!TypeOK,"ERROR","Unsupported registry type: ":Type) Data = RegQueryEx(RegHandle,KeyVal,Num2Char(1),Type) Else KeyVal = Key Type = 0 Data = "" EndIf FileHandle = FileOpen(File,"Append") FileWrite(FileHandle,KeyVal:@TAB:Type:@TAB:Data) FileClose(FileHandle) Next SubRegHandle = RegOpenKey(RegHandle,Key) SubKeyList = RegQueryKeys(SubRegHandle) RegCloseKey(SubRegHandle) SubKeyCount = ItemCount(SubKeyList,@TAB) For i = 1 To SubKeyCount SubKey = ItemExtract(i,SubKeyList,@TAB) RegExport(RegHandle,Key:"\":SubKey,File) Next #EndFunction #DefineFunction RegImport(RegHandle,File) FileHandle = FileOpen(File,"Read") While @TRUE Line = FileRead(FileHandle) If Line=="*EOF*" Then Break KeyVal = ItemExtract(1,Line,@TAB) Type = ItemExtract(2,Line,@TAB) Data = ItemExtract(3,Line,@TAB) If Type==0 Then RegCreateKey(RegHandle,KeyVal) Else RegSetEx(RegHandle,KeyVal,Data,Num2Char(1),Type) EndWhile FileClose(FileHandle) #EndFunction ; Export File = "C:\RegExport.txt" If FileExist(File) Then FileDelete(File) RegExport(@REGCURRENT,"Software\VB and VBA Program Settings",File) Pause("Key exported to",File) ; Import RegImport(@REGCURRENT,File) Message("Key imported from",File)
Article ID: W18386
Filename: Export and Import Registry Keys.txt
File Created: 2008:04:25:07:18:32
Last Updated: 2008:04:25:07:18:32