Set Global EnvironmentVariable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dmitri Shvetsov

    #1

    Set Global EnvironmentVariable?

    Hi,

    Does somebody know how to create a new EnvironmentVari able, not only for a
    current session, but a global?

    I need to write something like an installation program and I want to add
    several global system variables for my application and a database. How can I
    do that?

    Thanks.

    Dmitri S.


  • Morten Wennevik

    #2
    Re: Set Global EnvironmentVari able?

    You can create application variables.

    Application["nameOfTheGloba lVariable"] = someObject;

    String text = (string)Applica tion["nameOfTheGloba lVariable"]

    You can create session variables this way too by using Session[].

    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Set Global EnvironmentVari able?

      Dmitri,

      In the section of the MSDN documentation titled "Environmen t Variables"
      (located at
      http://msdn.microsoft.com/library/de...variables.asp),
      it states:

      To programmaticall y add or modify system environment variables, add them to
      the HKEY_LOCAL_MACH INE\System\Curr entControlSet\C ontrol\Session
      Manager\Environ ment registry key, then broadcast a WM_SETTINGCHANG E message.
      This allows applications, such as the shell, to pick up your updates.

      Hope this helps.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m


      "Dmitri Shvetsov" <dshvetsov@cox. net> wrote in message
      news:D5pnb.8925 3$Ms2.60118@fed 1read03...[color=blue]
      > Hi,
      >
      > Does somebody know how to create a new EnvironmentVari able, not only for a
      > current session, but a global?
      >
      > I need to write something like an installation program and I want to add
      > several global system variables for my application and a database. How can[/color]
      I[color=blue]
      > do that?
      >
      > Thanks.
      >
      > Dmitri S.
      >
      >[/color]


      Comment

      Working...