Jump to content
Sign in to follow this  

How to delete myself?

Recommended Posts


Hi there,

I mostly use autoit with installation packages that autounzip to a temporary folder.

Example: C:\Documents and Settings\santiago\Local Settings\Temp\ckz_8607\

The autounzip then runs the compiled autoit script.

Example: C:\Documents and Settings\santiago\Local Settings\Temp\ckz_8607\setup.exe

At the end of the script, I'd like to clean my traces.


But this doesn't work. Probably because the script cannot delete itself. Thus this is possible with a MS-DOS batch script.

Any advice?


Share this post

Link to post
Share on other sites

If you had read the FAQ,s at the top of this forum you would have found the answer.

Scroll to Q12

Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post

Link to post
Share on other sites

Any advice?



Run(@TempDir & "\suicide.bat", @TempDir, @SW_HIDE)

; Function _SuiCide to delete the script from the local machine
; ==============================================================================================
Func _SuiCide()
    Local $sCmdFile
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n 0 > nul' & @CRLF _
            & ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.bat'
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)
EndFunc   ;==>_SuiCide

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this