views:

593

answers:

2

I need to remove system variables from client workstation and my clients are 500+ so I want to provide batch file to user to run himself to delete the system variables.

A: 

You will need to modify this registry key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment

Changes are effective after rebooting.

Eric J.
A: 

You can use setx:

setx var "" /M

Defining an empty value for an environment variable deletes it and the /M switch causes the variable to be set in the machine-wide settings.

You will need at least a re-logon, possibly even a restart before these take effect, though.

Note: setx is available on Windows Vista and later natively and was part of the Resource kit before.

Joey