Solved

regedit delete switch

Posted on 1998-12-16
16
436 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:smcurry
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:uilleann
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now