Get Environment variables
Imports System
Imports System.Collections
Class Sample
Public Shared Sub Main()
Dim str As [String]
Dim query As [String] = "%SystemDrive% and %SystemRoot%"
str = Environment.ExpandEnvironmentVariables(query)
Console.WriteLine("GetEnvironmentVariable: My temporary directory is {0}.",Environment.GetEnvironmentVariable("TEMP"))
Dim environmentVariables As IDictionary = Environment.GetEnvironmentVariables()
Dim de As DictionaryEntry
For Each de In environmentVariables
Console.WriteLine(" {0} = {1}", de.Key, de.Value)
Next de
Console.WriteLine("GetFolderPath: {0}",Environment.GetFolderPath(Environment.SpecialFolder.System))
Dim drives As [String]() = Environment.GetLogicalDrives()
Console.WriteLine("GetLogicalDrives: {0}", [String].Join(", ", drives))
End Sub
End Class
Related examples in the same category