Find the physical path of windows environmental variables (C#/Forms App)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    Find the physical path of windows environmental variables (C#/Forms App)

    I want to get the actual physical path for some of the Windows Environmental Variables.

    If I typed %TEMP% into the Run prompt on Vista, I'd go to the folder: C:\Users\userna me\AppData\Loca l\Temp

    I tried putting %TEMP% as the path for a DirectoryInfo object, but that didn't work. Does anyone know how to do this?
  • Chanjal
    New Member
    • Jun 2008
    • 4

    #2
    Try this out

    String Temp = System.Environm ent.GetEnvironm entVariable("TE MP");

    Use the string Temp in your Directory Info. All the enviornment variables can be obtained using GetEnviornmentV ariable function.

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Originally posted by Chanjal
      Try this out

      String Temp = System.Environm ent.GetEnvironm entVariable("TE MP");

      Use the string Temp in your Directory Info. All the enviornment variables can be obtained using GetEnviornmentV ariable function.
      Thanks a lot, for some reason I always forget about System.Environm ent. I appreciate the help.

      Comment

      Working...