Jumat, 12 Juni 2020

Kill Program By Process Name .NET

Killing the process outright is possible, but outright rude and dangerous: what if the user has important unsaved changes in an open document? Not to mention the stale temporary files this will leave behind.

Sample code :

                Dim lstOprograms As String() = {
                     "Unknown",
                     "TPC.exe",
                     "TPC"}
                For Each prog As Process In Process.GetProcesses
                    For Each nm As String In lstOprograms
                        If prog.ProcessName = nm Then
                            prog.Kill()
                            Exit For
                        End If
                    Next
                Next

Kill Program By Process Name .NET

Posting Komentar