C#

[C#] 현재폴더와 실행 프로세스 결합 경로

데브프로그라 2024. 2. 21. 00:06
반응형

가. 프로세스 이름 가져오기
System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
string strProcess = currentProcess.ProcessName;

나. 현재의 실행 폴더를 가져온다.
string strFolder = System.IO.Directory.GetCurrentDirectory();

다. 현재 폴더와 프로세스를 결합한 파일경로
string strFilePath = string.Format("{0}\\{1}.exe", System.IO.Directory.GetCurrentDirectory(), this.currentProcess.ProcessName);

반응형