Script needed to delete registry key value
My application is related to Add-In. I want to delete a registry value data from Current User.
First I will say the scenario of my application.
I have installed one add-in application then it is creating one current user entry ie.,.HKCU\Software\Microsoft\Office\11.0\Excel\Options Open="Path of .xla file".
After this I installed my application then it is creating one current user entry ie,.
HKCU\Software\Microsoft\Office\11.0\Excel\Options Open1="Path of my application .xla file".
During uninstallation I need to delete only Path of .xla file not Open. Because We dont know how many Add-In applications are installed before installing my application.
So I need a script to delele Data in Registy Key.ie,. Path of .xla file.
First I will say the scenario of my application.
I have installed one add-in application then it is creating one current user entry ie.,.HKCU\Software\Microsoft\Office\11.0\Excel\Options Open="Path of .xla file".
After this I installed my application then it is creating one current user entry ie,.
HKCU\Software\Microsoft\Office\11.0\Excel\Options Open1="Path of my application .xla file".
During uninstallation I need to delete only Path of .xla file not Open. Because We dont know how many Add-In applications are installed before installing my application.
So I need a script to delele Data in Registy Key.ie,. Path of .xla file.
0 Comments
[ + ] Show comments
Answers (11)
Please log in to answer
Posted by:
volantedesktop
16 years ago
Hopefully this will help you:
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Test"
strValueName = "Sample Value 1"
objRegistry.DeleteValue HKEY_CURRENT_USER, strKeyPath, strValueName
Also got to this website and download the archives... Very handy for reference:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.mspx
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Test"
strValueName = "Sample Value 1"
objRegistry.DeleteValue HKEY_CURRENT_USER, strKeyPath, strValueName
Also got to this website and download the archives... Very handy for reference:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.mspx
Posted by:
sanhivi
16 years ago
Posted by:
anonymous_9363
16 years ago
No, no, no, no, NO! NEVER use the 'Open' value when dealing with XL add-ins, and you should certainly avoid hard-coded Office versions in script. Use XL's Automation to add and remove its add-ins. Search *this* forum for 'Excel' and 'add-in' and you'll find examples. Or, if all else fails, there's a search thingy called 'Google' which is proving quiote popular these days.
Now, what on earth does this:
Also, why on earth do you want to remove only the data in that entry? I could understand if you wanted to replace it. If you leave it there with no data and the user subsequently adds another add-in, XL is going to become confused, as will the user when he opens the add-ins menu and sees a blank entry in his list of available add-ins.
Now, what on earth does this:
ORIGINAL: sanhivimean? That isn't a script. What is it?
Name Type Data
Open REZ_SZ C:\ProgramFiles\Panopticon\abc.xla
Also, why on earth do you want to remove only the data in that entry? I could understand if you wanted to replace it. If you leave it there with no data and the user subsequently adds another add-in, XL is going to become confused, as will the user when he opens the add-ins menu and sees a blank entry in his list of available add-ins.
Posted by:
Ram
16 years ago
Posted by:
anonymous_9363
16 years ago
Posted by:
ratheeshtravi
15 years ago
Posted by:
anonymous_9363
15 years ago
Posted by:
sayeenath@gmail.com
15 years ago
Posted by:
anonymous_9363
15 years ago
Set Sh = CreateObject("WScript.Shell")Again, a hard-coded Office version number (BAD idea) and an assumption that the add-in is in the first position (add-ins are referenced as 'Open' for the first, 'Open1' for the second, 'Open2' for the third and so on.
key = "HKEY_CURRENT_USER\"
Sh.RegWrite key & "Software\Microsoft\Office\11.0\Excel\Options\Open", ""
Posted by:
OriginalM
15 years ago
Posted by:
anonymous_9363
15 years ago
REG ADD "HKCU\Software\Microsoft\Office\11.0\Excel\Options" /V "Open1" /T REG_SZ /FAaaaaaaaaaand, yet again, a hard-coded Office version number (BAD idea) and an assumption that the add-in is in the first position (add-ins are referenced as 'Open' for the first, 'Open1' for the second, 'Open2' for the third and so on. )
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.