%systemroot% from registry

Discussion in 'Windows XP General' started by Guest, Nov 25, 2005.

  1. Guest

    Guest Guest

    How do I obtain the value of the %systemroot% environment variable from the
    registry? I looked in the following registry key that is supposed to contain
    all the "system" environment variables to no avail:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
    Manager\Environment. Actually many of the environment variables listed under
    this key are in terms of %systemroot%!

    I tried searching in the Microsoft Knowledge Base without much luck.

    Thanks for any help!
     
    Guest, Nov 25, 2005
    #1
    1. Advertisements

  2. Hi,

    The SystemRoot value (type REG_SZ) under the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\
     
    Torgeir Bakken \(MVP\), Nov 25, 2005
    #2
    1. Advertisements

  3. Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion for
    SystemRoot. Better to read the environment variable than querying specific
    registry keys for this type of data though as different versions of Windows
    source this information differently but it always ends up in environment
    variables.
    --
    Tom Porterfield
    MS-MVP Windows
    http://support.telop.org

    Please post all follow-ups to the newsgroup only.
     
    Tom Porterfield, Nov 25, 2005
    #3
  4. Guest

    Guest Guest

    Possibly.
    Start>Run>cmd>echo %systemroot%
     
    Guest, Nov 25, 2005
    #4
  5. Guest

    Guest Guest

    Thanks a lot for all the replies and suggestions!
     
    Guest, Nov 25, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.