vbscript - VBS RegRead doesn't return value -
i've got following code:
dim objshell,failing_path,working_path failing_path = "hkey_local_machine\software\microsoft\windows\currentversion\uninstall\test" working_path = "hkey_local_machine\software\7-zip\path" set objshell = wscript.createobject("wscript.shell") wscript.echo "working: " & objshell.regread(working_path) wscript.echo "not working: " & objshell.regread(failing_path)
when executing path 7-zip registrykey
, test
key returns following error:
error says: registry wasn't opened reading.
here proof test-key exists:
what doing wrong? tried read key via oreg.getstringvalue
returned null.
it seems script running in 32-bit compatible scripting host in 64-bit os. since 32 bit applications automatically redirected wow6432node
areas of registry in 64-bit oses, regread
method tries read 32-bit equivalent path like
hklm\software\wow6432node\microsoft\windows\currentversion\uninstall\test
instead
hklm\software\microsoft\windows\currentversion\uninstall\test
so, if redirected path not exist receive error expected.
you may need force run scripts in 64-bit compatible scripting hosts rid of kind of implicit registry redirects.
Comments
Post a Comment