|
-
Jan 27th, 2007, 12:23 AM
#1
Thread Starter
Addicted Member
[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:
If Directory.Exists("%WINDIR%\system32") Then
MsgBox("yes")
Else
MsgBox("no")
End If
This doesn't work, how can I get this to work?
-
Jan 27th, 2007, 03:16 AM
#2
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");
-
Jan 27th, 2007, 03:31 PM
#3
Thread Starter
Addicted Member
Re: [02/03] Using environment variables in file path
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|