Environment.GetLogicalDrives 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 컴퓨터에서 논리 드라이브의 이름을 검색합니다.
public:
static cli::array <System::String ^> ^ GetLogicalDrives();
public static string[] GetLogicalDrives();
static member GetLogicalDrives : unit -> string[]
Public Shared Function GetLogicalDrives () As String()
반품
논리 드라이브 이름을 나타내는 문자열 배열입니다.
예외
I/O 오류가 발생합니다.
호출자에게 필요한 권한이 없습니다.
예제
다음 예제에서는 메서드를 사용 하 여 현재 컴퓨터의 논리 드라이브를 표시 하는 방법을 보여 있습니다 GetLogicalDrives .
// Sample for the Environment.GetLogicalDrives method
using System;
class Sample
{
public static void Main()
{
Console.WriteLine();
String[] drives = Environment.GetLogicalDrives();
Console.WriteLine("GetLogicalDrives: {0}", String.Join(", ", drives));
}
}
/*
This example produces the following results:
GetLogicalDrives: A:\, C:\, D:\
*/
// Sample for the Environment.GetLogicalDrives method
open System
let drives = Environment.GetLogicalDrives()
String.concat ", " drives
|> printfn "\nGetLogicalDrives: %s"
// This example produces the following results:
// GetLogicalDrives: A:\, C:\, D:\
' Sample for the Environment.GetLogicalDrives method
Class Sample
Public Shared Sub Main()
Console.WriteLine()
Dim drives As [String]() = Environment.GetLogicalDrives()
Console.WriteLine("GetLogicalDrives: {0}", [String].Join(", ", drives))
End Sub
End Class
'
'This example produces the following results:
'
'GetLogicalDrives: A:\, C:\, D:\
'
설명
Windows GetLogicalDrives "<drive letter>:\" 형식(예: "C:\")으로 광학 드라이브 또는 이동식 미디어 디바이스를 포함하여 특정 컴퓨터에서 액세스할 수 있는 모든 드라이브의 이름을 반환합니다. Unix에서는 특정 컴퓨터에 탑재된 모든 파일 시스템 탑재 지점의 경로(예: "/home/user", "/media/usb")를 반환합니다.