VB.NET 强制删除文件

时间:2022-05-18 14:03:45
Private Sub KillProcess(ByVal processName As String) ' 杀进程代码
         Dim myproc As System.Diagnostics.Process = New System.Diagnostics.Process
         Try
             For Each thisproc As Process In Process.GetProcessesByName(processName)
                 If (Not thisproc.CloseMainWindow()) Then
                     thisproc.Kill()
                 End If
             Next
         Catch
         End Try
     End Sub