C# Process 생성, 찾기, 파괴


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System.Diagnostics;
 
namespace Test {
    class Program {
 
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            var sample = Process.Start(fileName);
 
            foreach (var process in Process.GetProcesses()) {
                if (process.Id != sample.Id) continue;
                process.Kill();
            }
        }
    }
}
 
cs

프로세스 생성후 전체 프로세스에서 샘플을 찾아서 파괴 시킴.


C# 웹 브라우저 실행 시키기

System.Diagnostics.Process.Start("http://url"); 

Process.Start에 url주소를 입력 하면 실행 됨.

반응형