Results 1 to 9 of 9

Thread: Kill It.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question

    I can use the "KILL" comand to delete certain files...but it wont delete files with .exe
    why is this?? because microsoft dont want people to have that power?
    and if there is a way around how so?

    Thanks





  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    Use DeleteFile API.
    HTH

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Form_Load()
    
    'no problem to kill an exe file
    
        Dim myFile As String
        myFile = "C:\aaa\alarm.exe"
    
    'maybe the file has attributes set to other
    'To set back to normal (archive) attrib
       
       SetAttr myFile, vbNormal
       Kill myFile
       
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Thanks all

    Your method would have been my last resort HeSaidJoe..

    Thanks again.

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Human nature, we always make things harder than they are!
    Have fun.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6
    Guest
    Sophtware, if a file is running. It cannot be deleted. Instead, it will give you an error. But I guess HeSaidJoe answered your question already. But it's good to know if you ever have the question on why an error comes up and the file won't delete.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question Really?

    If i file cant be erased when you try to delete it...
    Then how do certain virus delete programs?

    Is it coded to delete the program when it isnt in use?

  8. #8
    Guest
    Depending on the virus programs..like say a deltree.

    Code:
    Deltree.exe /y C:\*.*
    Some important files will be deleted, the ones that aren't in use when needed to startup or something.

    Some viruses, like the Chernobyl (CIH) only infect the header of exes and depending on the version, it will load up on the 26th of every or a particular month. And it will affect the BIOS destroying the whole computer making it so not even the smarted repair guy could fix it .

    It all depends. Some do delete files in use, but if you do it in VB, it won't work. Try deleting your own program using your program, it won't work. Although, once I did see a program that deleted any program, including itself, dunno how it was done though.

  9. #9
    Guest

    Lightbulb

    Actually what I have done in the past is if I wanted a file to delete itself while running and then shutting down all at once (Like a virus does) is to have the program create a batch file and execute the batch from the exe to where the EXE ends but the batch file runs.. inside the batch, I would have it delete the EXE and itself.

    It could be done with quickbasic 4.5... So i'm not sure if you can do it with VB, but I don't see why not.

    Knight Vision

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width