Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links


Remove system environment variable using command line ?

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 12-06-2009
Vilius Mockûnas
 
Posts: n/a
Remove system environment variable using command line ?

Sponsored Links
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



Reply With Quote
  #2  
Old 12-06-2009
Pegasus [MVP]
 
Posts: n/a
Re: Remove system environment variable using command line ?


"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


Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Remove system environment variable using command line ?"
Thread Thread Starter Forum Replies Last Post
How to Enable system protection from command line Abhaa Operating Systems 4 30-01-2011 05:47 PM
Importance of Command Line User Environment in Linux aFRODITA Operating Systems 4 12-11-2010 06:31 AM
Is " CLUE" Command Line User Environment important aspect of linux Loyalpalm Operating Systems 5 11-11-2010 10:10 AM
How to change/add environment variables from command line PERMANENTLY? Moiz Windows XP Support 2 01-04-2009 05:46 PM
system restore from command line merrittr Windows XP Support 7 27-08-2008 12:45 AM


All times are GMT +5.5. The time now is 08:49 PM.