VB.Net檢查進程是否存在及關閉進程


Dim i As Integer
Dim proc As Process()
 
'判斷excel進程是否存在
If System.Diagnostics.Process.GetProcessesByName("excel").Length > 0 Then
    proc = Process.GetProcessesByName("excel")
    '得到名爲excel進程個數,全部關閉
    For i=0 to proc.Length -1
        proc(i).Kill()
    Next
End If
proc = Nothing
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章