Created
June 19, 2018 15:04
-
-
Save spinningcat/5154f118539bf4bf56c26585c35f87b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment