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);

반응형

/* 코드복사 버튼 */ pre { position: relative; overflow: visible; } pre .copy-button { opacity: 0; position: absolute; right: 8px; top: 4px; padding: 6px 18px; color: rgb(255, 255, 255); background: rgba(255, 223, 0, 0.6); border-radius: 5px; transition: opacity .3s ease-in-out; } pre:hover .copy-button { opacity: 1; } pre .copy-button:hover { color: #eee; transition: all ease-in-out 0.3s; } pre .copy-button:active { color: #33f; transition: all ease-in-out 0.1s; } .copy-message:before { content: attr(copy-message); position: absolute; left: -95px; top: 0px; padding: 6px 18px; color: #fff; background: rgba(255, 223, 0, 0.6); border-radius: 5px; } /* 코드복사 버튼 END */