Csharp
C# - 외부 프로그램과 링크 실행, 종료
sckwon770
2019. 7. 22. 22:02
Setup
Using System.Diagnostics
Usage
- 외부 프로그램 실행과 링크 실행
1
2
3
4
5
|
string path = Application.StartupPath + "\\test.exe";
Process.Start(path);
string url = "www.google.com";
Process.Start(url);
|
cs |
- 프로그램의 폴더속 "test.exe" 실행
- www.google.com 을 기본브라우저로 접속
- 외부 프로그램 종료
1
2
3
4
5
6
7
8
|
foreach (Process process in Process.GetProcesses())
{
if(process.ProcessName.StartWith("test")
{
process.Kill();
}
}
|
cs |
- Process.GetProcesses( ) : 실행중인 프로세스 목록을 가져옴