本文整理匯總了VB.NET中System.Environment.CurrentDirectory屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET Environment.CurrentDirectory屬性的具體用法?VB.NET Environment.CurrentDirectory怎麽用?VB.NET Environment.CurrentDirectory使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Environment
的用法示例。
在下文中一共展示了Environment.CurrentDirectory屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
' 導入命名空間
Imports System.IO
Module Example
Public Sub Main()
If Environment.OSVersion.Platform = PlatformID.Win32NT Then
' Change the directory to %WINDIR%
Environment.CurrentDirectory = Environment.GetEnvironmentVariable("windir")
Dim info As New DirectoryInfo(".")
Console.WriteLine("Directory Info: " + info.FullName)
Else
Console.WriteLine("This example runs on Windows only.")
End If
End Sub
End Module
' The example displays output like the following on a .NET implementation running on Windows:
' Directory Info: C:\windows
' The example displays the following output on a .NET implementation on Unix-based systems:
' This example runs on Windows only.
示例2: MainClass
' 導入命名空間
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("CurrentDirectory: " & System.Environment.CurrentDirectory )
End Sub
End Class