Environment Variables - How to

Ask a Question related to Windows Server, Design and Development.

  1. #1

    Default Environment Variables - How to

    I'm wondering if there are such a command line/console version of setting
    the environment variables.

    Instead of using the GUI version, I'm used to create user using the console
    command, e.g:

    net user ...
    net user localgroup ...

    It is faster and I can use a .bat for automation.

    Now, I need to set up environment variables for all users in the systems.
    I'm using the control-panel -> system ->advanced -> environment variables to
    set up all the environment variables. How can I do that using the console
    windows(as administrator)?

    Thanks


    Sarah Tanembaum Guest

  2. Similar Questions and Discussions

    1. Setting Environment Variables
      Greetings, My ColdFusion application has to act slightly differently depending on whether it is on the live server or the develop server. The...
    2. J2EE environment variables
      Hi all, I need to know how to set the J2EE environment variables. I can see that the JAVA_HOME environment variable is set, but i also need the...
    3. HTA environment variables?
      I have an HTA (HTML Application) that builds another HTA and (after writing it to disk via FSO) invokes MSHTA.EXE to run it. Is it possible to...
    4. setting environment variables in IIS
      Hi, How can I set up environment variables to be used in the script in IIS ? Thanks, Pradeep
    5. who interpretes the environment variables
      My question is does Operating system interpretes any environment variable for any purpose?? Or does it just see them as name-value pairs?? ...
  3. #2

    Default Re: Environment Variables - How to

    use the SET command
    set myvar=fred
    echo %myvar%


    "Sarah Tanembaum" <sarahtanembaum@yahoo.com> wrote in message
    news:2k30rbF173vkrU1@uni-berlin.de...
    > I'm wondering if there are such a command line/console version of setting
    > the environment variables.
    >
    > Instead of using the GUI version, I'm used to create user using the
    console
    > command, e.g:
    >
    > net user ...
    > net user localgroup ...
    >
    > It is faster and I can use a .bat for automation.
    >
    > Now, I need to set up environment variables for all users in the systems.
    > I'm using the control-panel -> system ->advanced -> environment variables
    to
    > set up all the environment variables. How can I do that using the console
    > windows(as administrator)?
    >
    > Thanks
    >
    >

    Peter Guest

  4. #3

    Default Re: Environment Variables - How to


    "Peter" <bscinc@hotmail.com> wrote in message
    news:OSFUGDtWEHA.4032@TK2MSFTNGP11.phx.gbl...
    > use the SET command
    > set myvar=fred
    > echo %myvar%
    >
    >
    > "Sarah Tanembaum" <sarahtanembaum@yahoo.com> wrote in message
    > news:2k30rbF173vkrU1@uni-berlin.de...
    > > I'm wondering if there are such a command line/console version of
    setting
    > > the environment variables.
    > >
    > > Instead of using the GUI version, I'm used to create user using the
    > console
    > > command, e.g:
    > >
    > > net user ...
    > > net user localgroup ...
    > >
    > > It is faster and I can use a .bat for automation.
    > >
    > > Now, I need to set up environment variables for all users in the
    systems.
    > > I'm using the control-panel -> system ->advanced -> environment
    variables
    > to
    > > set up all the environment variables. How can I do that using the
    console
    > > windows(as administrator)?
    > >
    > > Thanks
    > >
    > >
    >
    >
    I know about setting it up for the current console, but I need to set up for
    all users and permanent as well.

    I know that you can do the above for the current windows, or use the login
    script to set that up, but I'm sure there are another where, I think, you
    have to write it to the registry so it will apply for all user.

    Thanks


    Sarah Tanembaum Guest

  5. #4

    Default Re: Environment Variables - How to


    "Peter" <bscinc@hotmail.com> wrote in message
    news:OSFUGDtWEHA.4032@TK2MSFTNGP11.phx.gbl...
    > use the SET command
    > set myvar=fred
    > echo %myvar%
    >
    >
    > "Sarah Tanembaum" <sarahtanembaum@yahoo.com> wrote in message
    > news:2k30rbF173vkrU1@uni-berlin.de...
    > > I'm wondering if there are such a command line/console version of
    setting
    > > the environment variables.
    > >
    > > Instead of using the GUI version, I'm used to create user using the
    > console
    > > command, e.g:
    > >
    > > net user ...
    > > net user localgroup ...
    > >
    > > It is faster and I can use a .bat for automation.
    > >
    > > Now, I need to set up environment variables for all users in the
    systems.
    > > I'm using the control-panel -> system ->advanced -> environment
    variables
    > to
    > > set up all the environment variables. How can I do that using the
    console
    > > windows(as administrator)?
    > >
    > > Thanks
    > >
    > >
    >
    >
    Perhaps any one can shed me some lights ---

    when I did Control Panel -> System ->Advanced -> Environment Variables and
    set some environment variables, where did it get written to? and how do one
    do it using the command line/console? Thanks


    Sarah Tanembaum Guest

  6. #5

    Default Re: Environment Variables - How to

    Sarah Tanembaum wrote:
    > I'm wondering if there are such a command line/console version of setting
    > the environment variables.
    Hi

    You can e.g use setx.exe for this.

    For WinXP yo it is included as a utility in the support tools installation
    package (on your WinXP CD) installed by suptools.msi.

    It is also in the free part of Win2000 Resource Kit:
    [url]http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/setx-o.asp[/url]

    I would think you can use either version on either OS version.


    When adding or removing components from the _path_ from the command line,
    I suggest using Pathman.exe (Path Manager).

    Pathman.exe can be downloaded from here:
    [url]http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/pathman-o.asp[/url]

    It will e.g. handle repeated entries.

    Pathman.exe is also in the Windows Server 2003 Resource Kit Tools
    [url]http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en[/url]

    (The kit will install on WinXP or later)


    --
    torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
    Administration scripting examples and an ONLINE version of
    the 1328 page Scripting Guide:
    [url]http://www.microsoft.com/technet/community/scriptcenter/default.mspx[/url]
    Torgeir Bakken \(MVP\) Guest

  7. #6

    Default Re: Environment Variables - How to


    "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
    news:OxozC6uWEHA.2716@tk2msftngp13.phx.gbl...
    > Sarah Tanembaum wrote:
    >
    > > I'm wondering if there are such a command line/console version of
    setting
    > > the environment variables.
    > Hi
    >
    > You can e.g use setx.exe for this.
    >
    > For WinXP yo it is included as a utility in the support tools installation
    > package (on your WinXP CD) installed by suptools.msi.
    >
    > It is also in the free part of Win2000 Resource Kit:
    >
    [url]http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/setx-o.asp[/url]
    >
    > I would think you can use either version on either OS version.
    >
    >
    > When adding or removing components from the _path_ from the command line,
    > I suggest using Pathman.exe (Path Manager).
    >
    > Pathman.exe can be downloaded from here:
    >
    [url]http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/pathman-o.asp[/url]
    >
    > It will e.g. handle repeated entries.
    >
    > Pathman.exe is also in the Windows Server 2003 Resource Kit Tools
    >
    [url]http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en[/url]
    >
    > (The kit will install on WinXP or later)
    >
    >
    > --
    > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
    > Administration scripting examples and an ONLINE version of
    > the 1328 page Scripting Guide:
    > [url]http://www.microsoft.com/technet/community/scriptcenter/default.mspx[/url]

    Thanks I will check it out, but in the mean time, I found this under:

    HKLM\Current ControlSet\Control\Session Manager\Environment\
    ....
    ....

    And it contains all the path I created plus some that I'm not quite
    understand.
    It has some hex number for certain Environment Variables. Any idea?

    Can I just export the above and reload into different machine that has
    similar setup? Thanks


    Sarah Tanembaum Guest

  8. #7

    Default Re: Environment Variables - How to

    Note that system environment variables are stored in;
    HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

    User environment variables are stored in;
    HKCU\Environment

    Also note the type is Reg_Expand_Sz which must be created with regedt32.exe
    Yes you can export and then import the *.reg file through regedit.exe but be
    careful with system variables.

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    [url]http://www.microsoft.com/protect[/url]


    "Sarah Tanembaum" wrote:
    | Thanks I will check it out, but in the mean time, I found this under:
    |
    | HKLM\Current ControlSet\Control\Session Manager\Environment\
    | ...
    | ...
    |
    | And it contains all the path I created plus some that I'm not quite
    | understand.
    | It has some hex number for certain Environment Variables. Any idea?
    |
    | Can I just export the above and reload into different machine that has
    | similar setup? Thanks
    |
    |


    Dave Patrick Guest

  9. #8

    Default Re: Environment Variables - How to

    Thanks Dave. What is that hex number represent? Is it the ascii number?
    Thanks

    "Dave Patrick" <mail@NoSpam.DSPatrick.com> wrote in message
    news:OZEvd0zWEHA.1368@TK2MSFTNGP10.phx.gbl...
    > Note that system environment variables are stored in;
    > HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    >
    > User environment variables are stored in;
    > HKCU\Environment
    >
    > Also note the type is Reg_Expand_Sz which must be created with
    regedt32.exe
    > Yes you can export and then import the *.reg file through regedit.exe but
    be
    > careful with system variables.
    >
    > --
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > [url]http://www.microsoft.com/protect[/url]
    >
    >
    > "Sarah Tanembaum" wrote:
    > | Thanks I will check it out, but in the mean time, I found this under:
    > |
    > | HKLM\Current ControlSet\Control\Session Manager\Environment\
    > | ...
    > | ...
    > |
    > | And it contains all the path I created plus some that I'm not quite
    > | understand.
    > | It has some hex number for certain Environment Variables. Any idea?
    > |
    > | Can I just export the above and reload into different machine that has
    > | similar setup? Thanks
    > |
    > |
    >
    >

    Sarah Tanembaum Guest

  10. #9

    Default Re: Environment Variables - How to

    You're probably looking at them through regedit hence the hex value for a
    type Reg_Expand_Sz element. Try looking at them with regedt32.exe

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    [url]http://www.microsoft.com/protect[/url]


    "Sarah Tanembaum" wrote:
    | Thanks Dave. What is that hex number represent? Is it the ascii number?
    | Thanks


    Dave Patrick Guest

  11. #10

    Default Re: Environment Variables - How to

    Dave,
    under regedt32, it display okay without the hex, but when I
    exported the Environment registry and read the text file, some values are in
    hex number. Any ideas?

    Thanks

    "Dave Patrick" <mail@NoSpam.DSPatrick.com> wrote in message
    news:eJYTbe4WEHA.2792@TK2MSFTNGP10.phx.gbl...
    > You're probably looking at them through regedit hence the hex value for a
    > type Reg_Expand_Sz element. Try looking at them with regedt32.exe
    >
    > --
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > [url]http://www.microsoft.com/protect[/url]
    >
    >
    > "Sarah Tanembaum" wrote:
    > | Thanks Dave. What is that hex number represent? Is it the ascii number?
    > | Thanks
    >
    >

    Sarah Tanembaum Guest

  12. #11

    Default Re: Environment Variables - How to

    Yes, don't worry about it. You can't read them with a text editor.

    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    [url]http://www.microsoft.com/protect[/url]


    "Sarah Tanembaum" wrote:
    | Dave,
    | under regedt32, it display okay without the hex, but when I
    | exported the Environment registry and read the text file, some values are
    in
    | hex number. Any ideas?
    |
    | Thanks


    Dave Patrick Guest

  13. #12

    Default Re: Environment Variables - How to


    "Dave Patrick" <mail@NoSpam.DSPatrick.com> wrote in message
    news:u$sH464WEHA.1380@TK2MSFTNGP09.phx.gbl...
    > Yes, don't worry about it. You can't read them with a text editor.
    >
    > --
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > [url]http://www.microsoft.com/protect[/url]
    >
    >
    > "Sarah Tanembaum" wrote:
    > | Dave,
    > | under regedt32, it display okay without the hex, but when I
    > | exported the Environment registry and read the text file, some values
    are
    > in
    > | hex number. Any ideas?
    > |
    > | Thanks
    >
    >
    Thanks.


    Sarah Tanembaum Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139