Adding, Checking, Removing Part of a Registry Key

(imported topic written by fhack)

I am trying to do this in an action script but I’m lost on how to check, add, and remove.

I need to add “S:\proddlls\pbnt;Z:.;Y:.;X:.;” to the end of the Path Key in

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment


But I want to be able to remove the “S:\proddlls\pbnt;Z:.;Y:.;X:.;” part only for the uninstall.

(imported comment written by jgolembi)


have you looked at the Windows Registry Wizard within the console. It makes the check and modify very easy.

For removal of registry key I would use the regdelete action command.

Here is an excerpt from the

help file


Deletes a registry key value of the given name, regardless of whether it currently exists or not.


regdelete “” “”

Where registry key is the name of the key and value name is the value in the registry key you wish to delete.


regdelete "


" “NeverShowExt”

Deletes the NeverShowExt value from the specified registry key.


This command is Windows-only. It will cause an action script to terminate on a Unix agent.

In order to delete a non-empty registry key and all its sub-keys, you need to create a file, say del.reg, that looks like this: REGEDIT4


There should be three lines in this file: the last line must be a blank. Note the dash (-) in front of the registry path. Now you can execute an action like this:

regedit /s del.reg

When this action is executed, the key named removethisandbelow, along with all its sub-keys, is deleted. You can use the appendfile command to build this .reg file.

If the specified key doesn’t already exist, it will be created by this command.

-John G

(imported comment written by Matt.Johnson)


If the console wizzard isn’t what you’re looking for; keep in mind that TEM can also execute DOS commands, and you can insert relevance in to actions. This is done in several steps. Please reply here if you want to go that route and I will post a contriution to the discussion.