#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    1
    Rep Power
    0

    itself deletion!!!


    Hi,

    How can a file delete itself??? Is it possible?...

    A friend helped me by shell function:
    '''''''''''''
    Private Sub Command1_Click()
    Dim file as String

    file = App.Path
    If Right(file, 1) <> "\" Then file = file & "\"
    file = file & App.EXEName & ".exe"
    Call Shell("start /m /w deltree /y " & file, vbHide)
    End

    End Sub

    ' Dont really need the /m
    ' or /w




    '''''''''''
    but it didn't work on 2K and XP OS. maybr the problrm with start.
    Any help?

    Best Regards,
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    Bavaria, Germany
    Posts
    140
    Rep Power
    12
    Hehe, nice virus you're writing ;-) No, you can't delete your binary file within the scope of your binary since the operating system locks it.

    A work-around would be to start your .exe in a .bat file like this:

    test.bat:

    Code:
      myExe.exe
      del myExe.exe

IMN logo majestic logo threadwatch logo seochat tools logo