본문 바로가기

자료

[C#/VB.NET] 실행파일 위치(폴더)를 나타내는 메서드

728x90

1. System.Reflection.Assembly.GetExecutingAssembly.Location

   현재 실행중인 파일의 경로명과 파일명 모두 가져온다. 경로까지만 가져오려면 \과 그 다음을 제거해야 함

 

2. System.AppDomain.CurrentDomain.BaseDirectory()

   경로명만 가져온다.

 

3. Application.StartupPath
   응용프로그램을 시작한 실행 파일의 경로(실행파일 이름 제외)를 가져온다.

 

4. My.Application.Info.DirectoryPath()
   응용프로그램이 저장된 디렉토리를 가져온다.

 

5. My.Computer.FileSystem.CurrentDirectory
현재 디렉터리를 가져오거나 설정합니다.

728x90