Jump to content

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.

DirRemove(@ScriptDir)

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

Any advice?

Santiago

Link to comment
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


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

Link to comment
Share on other sites

Any advice?

Santiago

Jupp:

_SuiCide()
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 127.0.0.1 > 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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...