Forum Search:
Forum.Brain-Cluster.com: Brain Cluster Technical Forum
Ultimate forum for Technical Discussions

Home » Microsoft » Windows Server » Windows Server General Help » Remove system environment variable using command line ?
Remove system environment variable using command line ? [message #164027] Fri, 12 June 2009 06:19 Go to next message
v_mockunas  is currently offline v_mockunas  Lithuania
Messages: 42
Registered: July 2009
Member
Hello,

How do I remove system environment variable using command line ?
For example I can add it using:
setx y 10 -m
But from setx documentation:
"You cannot use setx to remove values added to the local or system
environments."

(I know how to remove using GUI but this is not the case)

thanks
Vilius
Re: Remove system environment variable using command line ? [message #164028 is a reply to message #164027] Fri, 12 June 2009 06:40 Go to previous message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Vilius MockŻnas" <v_mockunas@yahoo.com> wrote in message
news:uOmTtc06JHA.5828@TK2MSFTNGP04.phx.gbl...
> Hello,
>
> How do I remove system environment variable using command line ?
> For example I can add it using:
> setx y 10 -m
> But from setx documentation:
> "You cannot use setx to remove values added to the local or system
> environments."
>
> (I know how to remove using GUI but this is not the case)
>
> thanks
> Vilius

The following script will first set, then remove the system variable %XVar%:
Set wshShell = CreateObject("WScript.Shell")
Set wshSEnv = wshShell.Environment("System")
sMyVar = "XVar"
wshSEnv(sMyVar) = "Vilius"
WScript.Echo "Variable " & sMyVar & " is now set to Vilius"
wshSEnv.Remove sMyVar
Previous Topic:The task doesn't run under specific account
Next Topic:2003: Local User Group and Domain Users
Goto Forum:
  


Current Time: Sat Aug 19 05:13:28 EDT 2017

Total time taken to generate the page: 0.30801 seconds
.:: Contact :: Home ::Sitemap::.

Powered by: FUDforum 3.0.0RC2.
Copyright ©2001-2009 FUDforum Bulletin Board Software