FileSystem.CombinePath(String, String) 메서드

정의

두 경로를 결합하고 적절한 형식의 경로를 반환합니다.

public:
 static System::String ^ CombinePath(System::String ^ baseDirectory, System::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

적용 대상

추가 정보