Programing

내 .exe의 경로 가져 오기

lottogame 2020. 5. 20. 07:48
반응형

내 .exe의 경로 가져 오기


내 .exe를 복사하면 새 경로를 얻을 수 있기 때문에 어떻게 .exe 경로를 얻을 수 있습니까?


System.Reflection.Assembly.GetEntryAssembly().Location;

게다가:

AppDomain.CurrentDomain.BaseDirectory
Assembly.GetEntryAssembly().Location

Windows Forms 프로젝트에서 :

전체 경로 (파일 이름 포함) : string exePath = Application.ExecutablePath;
경로 만 :string appPath = Application.StartupPath;


visualstudio 2008에서는 다음 코드를 사용할 수 있습니다.

   var _assembly = System.Reflection.Assembly
               .GetExecutingAssembly().GetName().CodeBase;

   var _path = System.IO.Path.GetDirectoryName(_assembly) ;

참고 URL : https://stackoverflow.com/questions/3991933/get-path-for-my-exe

반응형