Results 1 to 3 of 3

Thread: [RESOLVED] [02/03] Using environment variables in file path

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Ithaca, NY
    Posts
    145

    Resolved [RESOLVED] [02/03] Using environment variables in file path

    I can't seem to figure out how to use Windows environment variables(i.e. %SYSTEMROOT%, %APPDATA%, etc) in file paths... For example:

    VB Code:
    1. If Directory.Exists("%WINDIR%\system32") Then
    2.             MsgBox("yes")
    3.         Else
    4.             MsgBox("no")
    5.         End If

    This doesn't work, how can I get this to work?

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: [02/03] Using environment variables in file path

    you want to look at the System.Environment class, which has the method GetEnvironmentVariable(). one other thing to note is that MsgBox() is from VB6 and is provided for compatibility reasons. the .NET equivalent is to use MessageBox.Show("yes");
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Ithaca, NY
    Posts
    145

    Re: [02/03] Using environment variables in file path

    ok thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width