Environment.GetFolderPath 메서드

정의

지정된 열거형으로 식별되는 시스템 특수 폴더의 경로를 가져옵니다.

오버로드

GetFolderPath(Environment+SpecialFolder)

지정된 시스템 특수 폴더의 경로를 가져옵니다.

GetFolderPath(Environment+SpecialFolder, Environment+SpecialFolderOption)

특수 폴더에 액세스하기 위해 지정된 옵션을 사용하여 지정된 시스템 특수 폴더의 경로를 가져옵니다.

GetFolderPath(Environment+SpecialFolder)

지정된 시스템 특수 폴더의 경로를 가져옵니다.

public:
 static System::String ^ GetFolderPath(Environment::SpecialFolder folder);
public static string GetFolderPath (Environment.SpecialFolder folder);
static member GetFolderPath : Environment.SpecialFolder -> string
Public Shared Function GetFolderPath (folder As Environment.SpecialFolder) As String

매개 변수

folder
Environment.SpecialFolder

시스템 관련 폴더를 식별하는 열거형 값 중 하나입니다.

반환

해당 폴더가 실제로 컴퓨터에 있으면 지정한 시스템 특수 폴더에 대한 경로이고, 그렇지 않으면 빈 문자열("")입니다.

운영 체제에서 폴더를 만들지 않았거나, 기존 폴더가 삭제되었거나, 폴더가 My Computer와 같이 실제 경로에 해당하지 않는 가상 디렉터리인 경우 해당 폴더는 실제로 존재하지 않습니다.

예외

folderEnvironment.SpecialFolder의 멤버가 아닙니다.

현재 플랫폼이 지원되지 않습니다.

예제

다음 예제에서는 메서드를 사용하여 GetFolderPath 매개 변수와 연결된 folder 경로를 반환하고 표시하는 방법을 보여 줍니다.

// Sample for the Environment::GetFolderPath method
using namespace System;
int main()
{
   Console::WriteLine();
   Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) );
}

/*
This example produces the following results:

GetFolderPath: C:\WINNT\System32
*/
// Sample for the Environment.GetFolderPath method
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine();
    Console.WriteLine("GetFolderPath: {0}",
                 Environment.GetFolderPath(Environment.SpecialFolder.System));
    }
}
/*
This example produces the following results:

GetFolderPath: C:\WINNT\System32
*/
// Sample for the Environment.GetFolderPath method
open System

printfn $"\nGetFolderPath: {Environment.GetFolderPath Environment.SpecialFolder.System}"
            
// This example produces the following results:
//     GetFolderPath: C:\WINNT\System32
' Sample for the Environment.GetFolderPath method
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.System))
   End Sub
End Class
'
'This example produces the following results:
'
'GetFolderPath: C:\WINNT\System32
'

설명

이 메서드는 일반적인 정보에 액세스하는 데 사용할 수 있는 프로그램 파일, 프로그램, 시스템 또는 시작과 같은 시스템 특수 폴더의 경로를 검색합니다. 특수 폴더는 Windows 버전을 설치할 때 기본적으로 시스템 또는 사용자가 명시적으로 설정합니다.

매개 변수는 folder 검색할 특수 폴더를 지정하며 열거형의 값 Environment.SpecialFolder 중 하나여야 합니다. 다른 값은 예외를 throw합니다.

특수 폴더에 대한 자세한 내용은 CSIDL(상수 특수 항목 ID 목록)을 참조하세요.

추가 정보

적용 대상

GetFolderPath(Environment+SpecialFolder, Environment+SpecialFolderOption)

특수 폴더에 액세스하기 위해 지정된 옵션을 사용하여 지정된 시스템 특수 폴더의 경로를 가져옵니다.

public:
 static System::String ^ GetFolderPath(Environment::SpecialFolder folder, Environment::SpecialFolderOption option);
public static string GetFolderPath (Environment.SpecialFolder folder, Environment.SpecialFolderOption option);
static member GetFolderPath : Environment.SpecialFolder * Environment.SpecialFolderOption -> string
Public Shared Function GetFolderPath (folder As Environment.SpecialFolder, option As Environment.SpecialFolderOption) As String

매개 변수

folder
Environment.SpecialFolder

시스템 관련 폴더를 식별하는 열거형 값 중 하나입니다.

option
Environment.SpecialFolderOption

특수 폴더에 액세스하는 데 사용할 옵션을 지정하는 열거형 값 중 하나입니다.

반환

해당 폴더가 실제로 컴퓨터에 있으면 지정한 시스템 특수 폴더에 대한 경로이고, 그렇지 않으면 빈 문자열("")입니다.

운영 체제에서 폴더를 만들지 않았거나, 기존 폴더가 삭제되었거나, 폴더가 My Computer와 같이 실제 경로에 해당하지 않는 가상 디렉터리인 경우 해당 폴더는 실제로 존재하지 않습니다.

예외

folderEnvironment.SpecialFolder의 멤버가 아닙니다.

또는

optionsEnvironment.SpecialFolderOption의 멤버가 아닙니다.

현재 플랫폼이 지원되지 않습니다.

설명

이 메서드는 일반적인 정보에 액세스하는 데 사용할 수 있는 프로그램 파일, 프로그램, 시스템 또는 시작과 같은 시스템 특수 폴더의 경로를 검색합니다. 특수 폴더는 Windows 버전을 설치할 때 기본적으로 시스템 또는 사용자가 명시적으로 설정합니다.

매개 변수는 folder 검색할 특수 폴더를 지정하며 열거형의 값 Environment.SpecialFolder 중 하나여야 합니다. 다른 값은 예외를 throw합니다.

특수 폴더에 대한 자세한 내용은 CSIDL(상수 특수 항목 ID 목록)을 참조하세요.

추가 정보

적용 대상