Jump to content

how to delete aregistry key with script?


Recommended Posts


i was hoping for something using regedit

i know this:

How to delete keys and values from the registry:

Create a reg file like this, notice the hyphen inside the first bracket

REGEDIT4

[-HKEY_CURRENT_USER\SomeKey]

When double clicking this .reg file the key "SomeKey" will be deleted along with all string, binary or Dword values in that key.

If you want to just delete values leaving the key in place, set the value you want to delete = to a hyphen

e.g.

REGEDIT4

[HKEY_CURRENT_USER\SomeKey]

"SomeStringValue"=-

but i want to delete the whole value(stop msn and windows messengers from stating at startup)

Link to comment
Share on other sites

You can't delete values using the regedit '-' (minus) sign?

I will look into that.

This will do the trick but there must be simpler way:

'Initialization SectionConst RegKey  = "HKCU\SomeKey\"Const RegVal = "SomeStringValue"
'Set up an instance of the WSS objectSet WSS = WScript.CreateObject("WScript.Shell")
'Try deal with any errorsOn Error Resume Next
WSS.RegDelete RegKey & RegValIF Err <> 0 then Err.Clear
Set WSS = NothingWscript.Quit

Save this as a .vbs file. Run with CScript.exe or WScript.exe like this:

"CScript DelReg.vbs //NoLogo"
Link to comment
Share on other sites

Afternoon turbomcp,

If your after stopping it from loading, you can do no worse than doing the below, this will actually UN-INSTALL it completely.

Make sure your Internet Explorer, Outlook Express, Windows Messenger and other programs are closed before doing this.

1) Click on Start, Run

2) Type the following (or cut and paste it) into the Run line

RunDll32 advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove

3) Click on OK

More ways of doing it can be found here =>

http://www.kellys-korner-xp.com/xp_messenger.htm

This includes, uninstalling, disabling service, stopping from autloading at startup and a few other

Hope that helps

Link to comment
Share on other sites

You wanted a script to do it but heres a cmd file. You can remove the pause from it unless you want to see the results.

First you NET STOP that Messenger service then set its start value to a 4 to prevent it from running on boot. This is NOT MSN Messenger

The PreventRun stops msn messenger from loading at start.

save below as Messenger.cmd

these are all 5 single lines but it gets wrapped here.

NET STOP Messenger
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\Messenger /v Start /t REG_DWORD /d "4" /f
REG ADD HKCU\Software\Policies\Microsoft\Messenger\Client /v PreventRun /t REG_DWORD /d "1" /f
pause
EXIT

I can whip this up in vbs or several other's can if you need it that way.

Link to comment
Share on other sites

You can't delete values using the regedit '-' (minus) sign?

I will look into that.

Hello Tim,

with ref to the above quote, I found this on M$, only url needed as is long doc =>

http://support.microsoft.com/default.aspx?...kb;en-us;310516

but essentially,

"Deleting Registry Keys and Values

To delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the Test subkey from the following registry key:

HKEY_LOCAL_MACHINE\Software

put a hyphen in front of the following registry key in the .reg file:

HKEY_LOCAL_MACHINE\Software\Test

The following example has a .reg file that can perform this task.

[-HKEY_LOCAL_MACHINE\Software\Test]

To delete a registry value with a .reg file, put a hyphen (-) after the equals sign following the DataItemName in the .reg file. For example, to delete the TestValue registry value from the following registry key:

HKEY_LOCAL_MACHINE\Software\Test"

As for how you can add this to a VBScript, i wouldn't know that answer sorry.

Link to comment
Share on other sites

thnaks to all:)

the greatest forum i know

great people who help eachother out

i managed to found it and added it to my reg tweaks:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]

"MsnMsgr"=-

"MSMSGS"=-

thanks again to everybody

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...