biase Posted August 15, 2010 Share Posted August 15, 2010 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. Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 15, 2010 Share Posted August 15, 2010 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) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
KaFu Posted August 15, 2010 Share Posted August 15, 2010 Take a look at the _RegExport() function in wraithdus Custom Registry Functions UDF. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
biase Posted August 15, 2010 Author Share Posted August 15, 2010 $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. Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 15, 2010 Share Posted August 15, 2010 $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. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
biase Posted August 15, 2010 Author Share Posted August 15, 2010 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. Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 15, 2010 Share Posted August 15, 2010 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) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
biase Posted August 15, 2010 Author Share Posted August 15, 2010 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now