Visual Basic delete self
The following function can be used in Visual Basic to delete a script or executable after it has been executed. This function also works to delete a executable using a UNC path.
1 |
Melt(1) |
1 2 3 4 5 6 7 8 9 |
Private Sub Melt(ByVal Timeout As Integer) Dim p As New System.Diagnostics.ProcessStartInfo("cmd.exe") p.Arguments = "/C ping 8.8.8.8 -n 1 -w " & Timeout.ToString & " > Nul & Del " & ControlChars.Quote & Application.ExecutablePath & ControlChars.Quote p.CreateNoWindow = True p.ErrorDialog = False p.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden System.Diagnostics.Process.Start(p) Application.Exit() End Sub |
Leave a Reply