Jump to content

Recommended Posts

Posted

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 :P.

Thx,

Holgh

 

 

Posted (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 by spudw2k
Posted

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?

Posted

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.

Posted

Mea Culpa,

you had the right instinct AdamUL.

32Bit AutoIt on a 64Bit OS ==> registry confusion

Thx alot!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...