windows - Unable to delete registry keys from batch file or VBS -


i have batch file deletes registry entries computer, batch file has following lines.

reg delete hkey_local_machine\software\test\installation\test-x64-9.2 /f > remove.log 2>&1 reg delete hkey_local_machine\software\test\service\test-x64-9.2 /f > remove.log 2>&1 

this batch file called installer (installanywhere guess). when installer runs , executes batch file, remove.log states:

error: system unable find specified registry key or value.   

when run batch file manually, works fine. thought there issue batch file, created vbscript delete reg entries. same thing again.
when run vbs manually, deleted reg keys when same vbs called installer, doesnot delete reg entries.

if permissions problem, guess have received permission denied error. did not. says error: system unable find specified registry key or value.

does know issue?

try vbscript

option explicit dim wshshell,mykey1,mykey2,mykeys,i mykey1 = "hkey_local_machine\software\test\installation\test-x64-9.2" mykey2 = "hkey_local_machine\software\test\service\test-x64-9.2" set wshshell = createobject("wscript.shell") mykeys = array(mykey1,mykey2) = lbound(mykeys) ubound(mykeys)     if regexists(mykeys(i)) = true         wshshell.regdelete(mykeys(i))         msgbox "the key " & dblquote(mykeys(i)) & " deleted ! ",vbinformation,dblquote(mykeys(i))     else         msgbox "error " & vbtab & err.description & vbcrlf & "the key " & dblquote(mykeys(i)) & " not found ! ",vbcritical,dblquote(mykeys(i))     end if next '************************************************************************ function regexists(value)     on error resume next     dim ws     set ws = createobject("wscript.shell")     val = ws.regread(value)     if (err.number = -2147024893) or (err.number = -2147024894)         regexists = false     else         regexists = true     end if end function '************************************************************************ function dblquote(str)     dblquote = chr(34) & str & chr(34) end function '************************************************************************ 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -