下面是簡單的程序:Process.Close()不關閉程序
class Program {
static void Main(string[] args) {
Process pr = new Process();
ProcessStartInfo prs = new ProcessStartInfo();
prs.FileName = @"notepad.exe";
pr.StartInfo = prs;
pr.EnableRaisingEvents = true;
pr.Start();
Thread.Sleep(2000);
pr.Close(); //how do I change this to close notepad
Console.WriteLine("press [enter] to exit");
Console.ReadLine();
}
}
如何改變這種做法,記事本將關閉?
Process.Close()並不意味着放棄進程 - 它只是意味着在進程和相關資源上釋放您的「本地」視圖。 – MethodMan
@DJKRAZE ...我知道......這就是爲什麼我問這個問題! – whytheq
你有工作的答案,你有點遲了你的迴應.. :) – MethodMan