Results 1 to 4 of 4

Thread: Self-delete a file

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288

    Self-delete a file

    I have a small application which will run only once on a computer. I would like it to delete itself after it has completed its work. Since it will be running, windows will not allow it to be deleted. One way that I know is to use RunOnce key in the registry. But what command should I enter in the key. Also, is there any other way to self-destruct a file.

    Thanks

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Mark
    -------------------

  3. #3
    jim mcnamara
    Guest
    RunOnce REGISTRY entries are deleted automatically, not the .exe file.

    See: http://support.microsoft.com/support.../Q137/3/67.asp

    Your choice is to is to shell out (to a .BAT file that deletes the .exe)
    and then immediately exit the current image file.

    I use a PowerBasic DOS routine that waits 2 seconds, then deletes the file. The .BAT is left behind as is the very small PB .exe

    Usage:
    In a .BAT file
    Code:
    echo off
    cd \where\mydir
    REM delfile waits two seonds, so use it only as the first delete call.
    c:\LocationOfDelfile\delfile c:\mydir\myfile.exe
    del c:\mydir\anotherfile.dat
    exit
    Attached is delfile source and .exe file
    Attached Files Attached Files

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    there is a file in the windows directory you can place a path in, when the system reboots the file at that path is deleted, i am not sure what the file is called sorry
    This is what I am looking for. As far as I remember, the entry has to be in Win.ini file, but I don't remember exactly.

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