Solved

regedit delete switch

Posted on 1998-12-16
16
440 Views
Last Modified: 2013-12-16
Is there a command line switch for regedit that will allow me to remove a single string value from a key?  I'm trying to automate the removal of an application that is starting at boot without having to visit 180 machines.
0
Comment
Question by:smcurry
  • 5
  • 4
  • 3
  • +4
16 Comments
 
LVL 6

Expert Comment

by:sgenther
ID: 1760413
I use a great program called "Multi-remote registry change".It alows you to connect to any machine Via the Computer Name and change the registry,The shareware version lets you change up to 20 pcs at a time right from you desktop. You can fine it here:
http://home.zdnet.com/windows/nt/downloads/registry.html
0
 

Author Comment

by:smcurry
ID: 1760414
I'm not completely unhappy with the sgenther's answer, however I would still like to find out if this is possible using regedit.
0
 
LVL 6

Expert Comment

by:sgenther
ID: 1760415
regedit is not a command line app its a gui app,You can do it with regedit by connecting to each remote pc then deleteing the key...but with 180 pc...that could take awhile.
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:smcurry
ID: 1760416
I understand the GUI aspect of regedit but I'm wondering if there is something similar to the /s switch that can be used with a text .reg file to add entries into the registry.  

For example: regedit /s foobar.reg - foobar.reg would contain something like:
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"NotePad"="NotePad.Exe"

This key would start notepad whenever the computer is booted.

Actually, it is an in entry in the key above that I want to remove.

Most documentation doesn't list the /s switch as an option for regedit.  I'm wondering if there is another hidden switch that I can't find.
0
 
LVL 6

Expert Comment

by:sgenther
ID: 1760417
Sorry about that....I was on the NT think bus!
The syntax and command-line switches for Regedit in real mode are as
follows:
 
  REGEDIT [/L:system] [/R:user] filename1
  REGEDIT [/L:system] [/R:user] /C filename2
  REGEDIT [/L:system] [/R:user] /E filename3 [regpath]
 
    /L:system         Specifies the location of the System.dat file.
    /R:user           Specifies the location of the User.dat file.
    filename1         Specifies the file(s) to import into the registry
    /C filename2      Specifies the file to create the registry from.
    /E filename3      Specifies the file to export the registry to.
    regpath           Specifies the starting registry key to export from.
                      (Defaults to exporting the entire registry).
 
To see this list, type "regedit /?" (without quotation marks) at the
command prompt.
This is all I could find.
0
 

Author Comment

by:smcurry
ID: 1760418
As you can see the /s switch is not included and I'm may have been misleading earlier.  It isn't require to import a file but it allow is to occur "silently" without the end-user seeing it.

There actually a /d switch I've gleaned from looking at the regedit.exe.  However, it only applies to an entire key and not just a single value.

Ideally I would like to remove just the single value but I suppose I could work something up that would export the key, remove the value from the export file, delete the key from the registry and then import.  More work and potentially a little more dangerous given it relies on deleting the entire key.
0
 
LVL 6

Expert Comment

by:sgenther
ID: 1760419
I still say give that program a try...Its great...I had to make changes on about 150 pcs (5 changes to be exact) and even with the 20 at a time limit I was done in under an hour.
0
 

Author Comment

by:smcurry
ID: 1760420
As you can see the /s switch is not included and I'm may have been misleading earlier.  It isn't require to import a file but it allow is to occur "silently" without the end-user seeing it.

There actually a /d switch I've gleaned from looking at the regedit.exe.  However, it only applies to an entire key and not just a single value.

Ideally I would like to remove just the single value but I suppose I could work something up that would export the key, remove the value from the export file, delete the key from the registry and then import.  More work and potentially a little more dangerous given it relies on deleting the entire key.
0
 
LVL 3

Expert Comment

by:uilleann
ID: 1760421
It can be done from a VB app, so if you know some programmer you could ask him/her to write you a program to do it.
Or you could post in the VB section with this question.

Good Luck!
0
 
LVL 1

Expert Comment

by:hddp666
ID: 1760422
It would be pretty simple to write a program that searches for the string you want to remove from the *.reg file, and then gets rid of it. In effect, you search for the string within the file, clip everything before and after it, and then paste them together to form the new file without the string.

You would have to know exactly what you want to remove from the *.reg file, of course.

You can write it in VB, C++, Delphi or whatever, and then compile it. You would then run it on all the machines, either from a diskette, or distributed over a network. The .exe can delete itself after it has done what it's supposed to. It should also create a backup of the file before changing it, in case you need it.


If you want, I can write the program for you.
0
 
LVL 8

Expert Comment

by:Koen
ID: 1760423
Don't bother writing programs which are available as freeware/shareware...

I pasted this from jsiinc (it's for NT but I'm sure it will work on W95 also)

170 » Freeware Command Line / Batch Registry & Environment editor.

REG is a handy Registry and Environment Variable batch and command line tool that supports operations
on the following Registry Hives:

    HKEY_LOCAL_MACHINE
    HKEY_USERS
    HKEY_CURRENT_USER

REG will:

 Add and Delete a Registry Key.
 Add, Delete and Change a Registry Value. It supports Value Types of:

    REG_SZ
    REG_DWORD
    REG_MULTI_SZ
    REG_EXPAND_SZ

 Add and Delete a directory in either the SYSTEM or USER PATH.
 Setting an Environment Variable in either the SYSTEM or USER environment.
 Setting Environment and PATH variables from a file.
 Setting multiple options from a file.
 Setting a Registry Value from the keyboard.

the url is : http://www.jsiinc.com/TIP0100/rh0170.htm
and has a link to download.  You could then create a batch file running this through the login script.

Good Luck
Koen
0
 

Author Comment

by:smcurry
ID: 1760424
I dl'd the utility REG and did some testing and it appears that it will do exactly what I'm looking for.

Thanks to all who answered, especially Koen who pointed out the utility.

This is my first posting to the service.  What is the procedure for assigning points or closing the question?

Sean
0
 
LVL 5

Expert Comment

by:tcalesa
ID: 1760425
Ghinstek,
I wish you had included that as part of you answer to my reg Q! I've been fiddling with regini, what a pain.

But I do appreciate your posting here, I'll use it.
Thanks
0
 

Expert Comment

by:korvan
ID: 1760426
smcurry: you have to reject any outstanding answers and request (via comment) that the person you wish to award the points to has to re-submit their comment(s) as an answer.
0
 
LVL 8

Accepted Solution

by:
Koen earned 50 total points
ID: 1760427
smcurry,

since it seem to have worked I'll repost as an answer :



I pasted this from jsiinc (it's for NT but I'm sure it will work on W95 also)

170 » Freeware Command Line / Batch Registry & Environment editor.

REG is a handy Registry and Environment Variable batch and command line tool that supports operations on the following Registry Hives:

HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_CURRENT_USER

REG will:

Add and Delete a Registry Key.
Add, Delete and Change a Registry Value. It supports Value Types of:

REG_SZ
REG_DWORD
REG_MULTI_SZ
REG_EXPAND_SZ

Add and Delete a directory in either the SYSTEM or USER PATH.
Setting an Environment Variable in either the SYSTEM or USER environment.
Setting Environment and PATH variables from a file.
Setting multiple options from a file.
Setting a Registry Value from the keyboard.

the url is : http://www.jsiinc.com/TIP0100/rh0170.htm 
and has a link to download.  You could then create a batch file running this through the login script.


Good Luck
Koen
0
 
LVL 8

Expert Comment

by:Koen
ID: 1760428
tcalesa,

I'm sorry but I don't recall your question about registry... Also I wasn't at all sure about it solving the problem since this utility came from the NT environment (which is why I posted as a comment...)

Regards
Koen

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question