holgh Posted May 18, 2016 Share Posted May 18, 2016 Hi, reading and writing single registry keys containing spaces using the AutoIt Registry Management functions is not my problem. But, exporting a whole registry branch (e.g. "HKEY_LOCAL_MACHINE\SOFTWARE\has spaces") using regedit.exe/reg.exe within AutoIt code did not work. (OS: Windows 7) I tried a lot: RunWait(@ComSpec & ' /k ' & 'regedit /a output.reg "HKEY_LOCAL_MACHINE\SOFTWARE\has spaces" ') ShellExecuteWait("regedit.exe ",'/a output.reg "HKEY_LOCAL_MACHINE\SOFTWARE\has spaces" , "") Run(@ComSpec & ' /k ' & 'reg.exe EXPORT "HKEY_LOCAL_MACHINE\SOFTWARE\has spaces" "output.reg " ' ) Executing a batch file with "Run" or "_RunDos" containing: regedit /a output.reg "HKEY_LOCAL_MACHINE\SOFTWARE\has spaces" variants with double quotes instead of single quotes etc. Execution from a shell always worked! Using a registry branch without spaces always worked! I guess, adding reg-files with reg.exe or registry.exe fails similarly (without testing it) My way out was using PsExec from SystemInternals: $exitCode = RunWait('PsExec -s -i -h regedit.exe /a output.reg "HKEY_LOCAL_MACHINE\SOFTWARE\has spaces" ', @SW_HIDE ) Pretty uncomfortable, i guess, but maybe one of you guys can prove me wrong or has a better idea . Thx, Holgh Link to comment Share on other sites More sharing options...
spudw2k Posted May 18, 2016 Share Posted May 18, 2016 (edited) No problems for me using this one: RunWait(@Comspec & ' /k reg EXPORT "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Action Center" export.reg',@ScriptDir) Edited May 18, 2016 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Trong Posted May 18, 2016 Share Posted May 18, 2016 (: RunWait('regedit.exe /e "' & @ScriptDir & '\File.reg" "HKEY_CURRENT_USER\Software\AutoIt v3"') Regards, Link to comment Share on other sites More sharing options...
holgh Posted May 18, 2016 Author Share Posted May 18, 2016 Thx for your immediate reply. You're right, it has nothing to do with space characters in the registry branch. Instead, when testing out my " HKEY_CURRENT_USER\Software" registry folder, there a some sub-folders which I can read out. With others, the command above could not find the registry key/value according to the return message. But these ones work, when using the reg command in the command shell. Access rights? Link to comment Share on other sites More sharing options...
holgh Posted May 18, 2016 Author Share Posted May 18, 2016 I found out, that I get different registry exports depending on using: RunWait(@Comspec & ' /k reg EXPORT "HKLM\Software" export.reg',@ScriptDir) RunWait(@Comspec & ' /k reg EXPORT "HKEY_LOCAL_MACHINE\Software" export.reg',@ScriptDir) and executing reg EXPORT "HKEY_LOCAL_MACHINE\Software" export2.reg in a command shell. Link to comment Share on other sites More sharing options...
AdamUL Posted May 18, 2016 Share Posted May 18, 2016 Are you running a 32 or 64 bit OS? Are you running 32 or 64 bit AutoIt? Adam holgh 1 Link to comment Share on other sites More sharing options...
holgh Posted May 18, 2016 Author Share Posted May 18, 2016 Mea Culpa, you had the right instinct AdamUL. 32Bit AutoIt on a 64Bit OS ==> registry confusion Thx alot! Link to comment Share on other sites More sharing options...
AdamUL Posted May 18, 2016 Share Posted May 18, 2016 Your welcome. As soon as I seen that you got different results, that was my first thought. Glad I could help. Adam Link to comment Share on other sites More sharing options...
holgh Posted May 19, 2016 Author Share Posted May 19, 2016 Just for completion of this thread, this call works (32-bit AutoIt on 64-Bit OS accessing 64-Bit registry key using reg.exe - with or without spaces in key ): RunWait(@Comspec & ' /c reg EXPORT "HKY_LOCAL_MACHINE\Software\has spaces" export.reg /reg:64',@ScriptDir) More info: https://support.microsoft.com/en-us/kb/948698 https://support.microsoft.com/en-us/kb/305097 Thx again for your help! 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