Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove registry

Status
Not open for further replies.

OrionCookies

Programmer
May 5, 2005
43
US
It might be easy for you folks but I can't figure it out.

here is my code:
'=========================================================

const regkey = "c:\winnt\i3\source\Wireless80211_NAIDesktopFW-WXP-L-P-001\AironetCB21AGCisco"

Dim Shell
Set Shell = CreateObject("WScript.Shell")
'===========================================
'Main script
'=========================================
deletekey

'======================================
Sub DeleteKey
Dim Value_Of_Key : Value_Of_Key = shell.regread("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath")

On Error Resume Next
shell.regdelete value_Of_Key & regkey, "REG_EXPAND_SZ"
end sub

'=========================================================

under device path in registry contain following string

%SystemRoot%\inf;%SystemDrive%\drivers\lan;%SystemDrive%\drivers\lan\d510;%SystemDrive%\Sysprep\Drivers\NIC\Broadcom\SP24461\WinXp;%SystemDrive%\Sysprep\Drivers\NIC\Intel\SP24562;c:\winnt\i3\source\Wireless80211_NAIDesktopFW-WXP-L-P-001\AironetCB21AGCisco


All I want to remove last string....;c:\winnt\i3\source\Wireless80211_NAIDesktopFW-WXP-L-P-001\AironetCB21AGCisco


thanks in advace
 
Sub DeleteKey
Const theKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath"
Dim Value_Of_Key
Value_Of_Key = Shell.RegRead(theKey)
Shell.RegWrite theKey, Replace(Value_Of_Key, ";" & regkey, 1, -1, 1), "REG_EXPAND_SZ"
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thanks for your(PHV (MIS)) quick reply,
when i ran this, i get invalid procedure call or argument:'Replace'
 
Sorry for the typo:
Shell.RegWrite theKey, Replace(Value_Of_Key, ";" & regkey, "", 1, -1, 1), "REG_EXPAND_SZ"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, this do it..

Again, thanks for you quick respond...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top