Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Text;
- namespace processstudy
- {
- class ProcessWatch
- {
- public void watch()
- {
- // Process.Start("cmd.exe");
- var process = new Process();
- // process.StartInfo.UseShellExecute = false;
- // You can start any process, HelloWorld is a do-nothing example.
- process.StartInfo.FileName = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";
- process.Start();
- process.WaitForExit(1000);
- process.Kill();
- //Process.GetProcessById(process.Id).Kill();
- //Process.GetProcessById(process.Close).Kill();
- //process.StartInfo.CreateNoWindow = true;
- //process.Start();
- //process.WaitForExit(10000);
- //process.Kill();
- }
- }
- }
- using System;
- using System.Diagnostics;
- namespace processstudy
- {
- class Program
- {
- static void Main(string[] args)
- {
- ProcessWatch pW = new ProcessWatch();
- pW.watch();
- }
- }
- }
Add Comment
Please, Sign In to add comment