FileSystem.CombinePath(String, String) 메서드

정의

두 경로를 결합하여 올바른 형식의 경로를 반환합니다.

public:
 static System::String ^ CombinePath(System::String ^ baseDirectory, System::String ^ relativePath);
public static string CombinePath (string baseDirectory, string? relativePath);
public static string CombinePath (string baseDirectory, string relativePath);
static member CombinePath : string * string -> string
Public Shared Function CombinePath (baseDirectory As String, relativePath As String) As String

매개 변수

baseDirectory
String

String. 결합할 첫 번째 경로입니다.

relativePath
String

String. 결합할 두 번째 경로입니다.

반환

지정된 경로의 조합입니다.

예외

baseDirectory 또는 relativePath에 잘못된 경로가 있습니다.

예제

이 예제에서는 디렉터리 경로와 파일 이름을 결합하여 올바른 형식의 경로를 만듭니다.

Dim fullPath = My.Computer.FileSystem.CombinePath(
    "C:\Documents and Settings\All Users\Documents\My Pictures", "picture.jpg")

이 예제에서는 두 경로를 결합하여 올바른 형식의 경로를 만듭니다.

Dim fullPath = My.Computer.FileSystem.CombinePath(
    "C:\Dir1\Dir2\Dir3", "..\Dir4\Dir5\File.txt")

이 예제에서는 를 반환합니다 C:\Dir1\Dir2\Dir4\Dir5\File.txt.

설명

이 메서드는 적절한 형식의 경로를 만들기 위해 초과 슬래시 표시 문자를 자른다.

다음 표에서 관련 된 작업의 예로 My.Computer.FileSystem.CombinePath 메서드.

대상 참조 항목
디렉터리 경로 및 파일 이름 결합 방법: Visual Basic에서 파일 경로의 구문 분석

적용 대상

추가 정보