How does the program delete itself?
Private sub button1_click (byvale as system.object, byval e as system.eventargs) Handles Button1.click
DIM DELSTRING AS STRING 'To write a string of batch file
Dim Appname As String
Appname = system.environment.getCommandLineargs (0) .replace (Directory.GetcurrentDirectory () & "/", "")
DELSTRING = "pause" & vbcrlf "can be changed, change to make batch files wait after a while, otherwise, if the program does not exit, it cannot be deleted smoothly.
DELSTRING = "DEL" & appname & vbrlf 'Generates the delete program command, the middle part is used to get the full path
DELSTRING = "DEL% 0" 'Delete the BAT file
DIM DELBATFILE AS New FileStream ("Delme.bat", FileMode.create) "Generates BAT Batch File
DIM BUFFER (100) as Byte
Buffer = system.text.Encoding.ascii.getbytes (delstring.tocharray) 'Transforms strings to byte stream
Delbatfile.write (buffer, 0, buffer.length) 'Write to BAT file
Delbatfile.flush ()
Delbatfile.close ()
Process.Start ("delme.bat") 'Executive Batch Processing File
Me.close ()
End Sub