C# 判斷程序是否存在
加入參考組件 System.Management;.
引用using System.Management;ObjectQuery oQuery = new ObjectQuery("Select * from Win32_Process Where Name = 'AutoUpData.exe'");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
if (oReturnCollection.Count > 0)
{
label4.Text = "存在";
}else{
label4.Text = "不存在";
}
留言