Setting Environment Variables

  • Thread starter Thread starter Jack Carlson
  • Start date Start date
J

Jack Carlson

Two questions:

1. The 'set' command seems to set user variables only. Is there any way
in which System variables can be set on the command line?

2. Is it possible to simply append a string to the existing path?

Thanks.
 
Jack,

To append a string to an existing path, just include the variable name in
the path. For instance,

set HUTCH=Test1
set HUTCH=%HUTCH%;Test2

If you echo %HUTCH%, it should display Test1;Test2

Thanks.

William Hutchison [MSFT]
 
In said:
Jack,

To append a string to an existing path, just include the variable name in
the path. For instance,

set HUTCH=Test1
set HUTCH=%HUTCH%;Test2

If you echo %HUTCH%, it should display Test1;Test2

Thanks.

William Hutchison [MSFT]

Thanks for the reply, William. My question concerned 2 issues:

1. First, with respect to appending a path to the existing path,
playing with variables in an instance of a cmd.exe doesn't really help
me. If you're suggesting

set %PATH%=%PATH;c:\some\new\path

will permanently add c:\some\new\path to my (or the System's) existing
path, that isn't at all the case.

2. With respect to setting System variables, I did discover setx.exe in
the resource kit, but the date (1996) suggests this may not be something
I want to use. Is there a better approach?

Thanks again.
 
The Set command ONLY sets Environment variables for that session of the command prompt window.
Close the window everything you Set there is gone.

You set Environment variables here:

Right-click My Computer | Propoerties | Advanced | Environment variables...

The User Variables are set at the top and the System variables set in the bottom pane.
 
Back
Top