[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?
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");
Re: [02/03] Using environment variables in file path