Jump to content

Recommended Posts

Posted

is there any way to save multiply registry to one file.reg?

autoit already regwrite, regread but have no regsave function.

i already search on forum and google, but i didnt found any clue to make a function to it.

Posted

Easiest method is using the 'reg.exe' command-line program, which I believe it requires XP or above.

Example:

$sRegBranch="HKEY_CURRENT_USER\Control Panel"
$sOutput=@DesktopDir&"\Control Panel export.reg"
Run(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sOutput&'"','',@SW_HIDE)
Posted

$sOutput=@DesktopDir&"\treg\multiply.reg"

$sRegBranch="HKEY_CURRENT_USER\AppEvents\Schemes\Names"
Run(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sOutput&'"','',@SW_HIDE)

$sRegBranch="HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KeyboardClass"
Run(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sOutput&'"','',@SW_HIDE)

when i run this code, it only save "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KeyboardClass" in reg file...

which mean it overwrite it.

i have tried "regedit /s /e" and it also gave me the same result as yours.

Posted

$sOutput=@DesktopDir&"\treg\multiply.reg"

$sRegBranch="HKEY_CURRENT_USER\AppEvents\Schemes\Names"
Run(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sOutput&'"','',@SW_HIDE)

$sRegBranch="HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KeyboardClass"
Run(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sOutput&'"','',@SW_HIDE)

when i run this code, it only save "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KeyboardClass" in reg file...

which mean it overwrite it.

i have tried "regedit /s /e" and it also gave me the same result as yours.

Should I point out the obvious? Okay, I will: You need to change the $sOutput filename otherwise you are always overwriting the same file.
Posted

that's the problem, i already know if we use "regedit /s /e" it will always overwrite the file... _RegExport() also overwrite the file.

sorry if my question earlier isnt clear...

before i start using autoit, i used to use NSIS to make portable apps for my own use and i always save multiply registry branch into a single file using ${registry::SaveKey}, after searching for 2hours for clue to make a function like that, i got none answer.

Posted

You could do a simple merge. Just get rid of the header - right up to the first registry key in the extra files. The below will do this for you for 2 branches.

Note that there's no @error checking, and also - you should use RunWait(), otherwise the rest of the code may run before the files are written to completely:

$sMainOutput=@DesktopDir&"\treg\multiply.reg"
$sOutput2=@DesktopDir&"\treg\multiply2.reg"

$sRegBranch="HKEY_CURRENT_USER\AppEvents\Schemes\Names"
RunWait(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sMainOutput&'"','',@SW_HIDE)

$sRegBranch="HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KeyboardClass"
RunWait(@SystemDir&'\reg.exe export "'&$sRegBranch&'" "'&$sOutput2&'"','',@SW_HIDE)

$sBuffer=FileRead($sOutput2)
$sBuffer=StringRegExpReplace($sBuffer,"^([^\[]+)","")
$hFile=FileOpen($sMainOutput,1)
FileWrite($hFile,$sBuffer)
FileClose($hFile)
Posted

i was thinking making function with looping RegEnumKey() and RegEnumVal() then save it to file... but it seems your method was more faster and easier...

thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...