Saturday, January 14, 2012

self deleter script

Sub KillMe()
Dim ff As Integer, batname As String, ext As String, batnum As Long
    ChDir App.Path
    ext = ".bat"
    Do
        batname = "DelMe" & Format(batnum) & ext
        batnum = batnum + 1
    Loop While Len(Dir(batname))
    ext = ".exe"
    ff = FreeFile
    Open batname For Output As ff
    Print #1, "@Echo off"
    Print #1, ":Repeat"
    Print #1, "del """ & App.EXEName & ext & """"
    Print #1, "if exist """ & App.EXEName & ext & """ goto Repeat"
    Print #1, "del " & batname
    Close #1
    batnum = Shell(batname, 0)
    End
end sub

No comments:

Post a Comment