Require help in deleting registry value
Hi Everybody,
Can any body give me the script to delete the registry value.
I am having below key and value.
Key Path Name Value
HKCU\Software\ABC\ C:\Program Files\XYZ\a.xla NULL
I have to delete "C:\Program Files\XYZ\a.xla".
I have used the below script to delete the above value.
On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
PrgFiles=WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
strKeyPath = PrgFiles & "\XYz\a.xla"
KeyName1 = "HKEY_CURRENT_USER\Software\ABC\" & strkeypath
WshShell.RegDelete KeyName1
But this is not working. Can any body help me on this.
Thanks
Sanhivi
Can any body give me the script to delete the registry value.
I am having below key and value.
Key Path Name Value
HKCU\Software\ABC\ C:\Program Files\XYZ\a.xla NULL
I have to delete "C:\Program Files\XYZ\a.xla".
I have used the below script to delete the above value.
On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
PrgFiles=WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
strKeyPath = PrgFiles & "\XYz\a.xla"
KeyName1 = "HKEY_CURRENT_USER\Software\ABC\" & strkeypath
WshShell.RegDelete KeyName1
But this is not working. Can any body help me on this.
Thanks
Sanhivi
0 Comments
[ + ] Show comments
Answers (5)
Please log in to answer
Posted by:
mayur_mak
12 years ago
@sanhivi
u can c if the below script works for u
const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\ABC"
strDWORDValueName = "C:\Program Files\XYZ\a.xla"
'strExpandedStringValueName = "Expanded String Value Name"
'strMultiStringValueName = "Multi String Value Name"
'strStringValueName = "String Value Name"
oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strDWORDValueName
'oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strExpandedStringValueName
'oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strMultiStringValueName
'oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName
regards,
Mayur
u can c if the below script works for u
const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\ABC"
strDWORDValueName = "C:\Program Files\XYZ\a.xla"
'strExpandedStringValueName = "Expanded String Value Name"
'strMultiStringValueName = "Multi String Value Name"
'strStringValueName = "String Value Name"
oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strDWORDValueName
'oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strExpandedStringValueName
'oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strMultiStringValueName
'oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName
regards,
Mayur
Posted by:
sanhivi
12 years ago
Posted by:
mahendraKumar
12 years ago
check this script ....
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
struserkey= "Software\ABC"
strDWORDValueName = "C:\Program Files\XYZ\a.xla"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
strtargetkey = objSubkey & "\" & struserkey
oReg.DeleteValue HKEY_USERS,strtargetkey,strDWORDValueName
Next
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
struserkey= "Software\ABC"
strDWORDValueName = "C:\Program Files\XYZ\a.xla"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
strtargetkey = objSubkey & "\" & struserkey
oReg.DeleteValue HKEY_USERS,strtargetkey,strDWORDValueName
Next
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.