Jump to content
Sign in to follow this  
alucard

uninstall

Recommended Posts

alucard

hi,

sorry for my bad english

I would like to make a script and convert it in a .exe

then when i lauch the .exe , it run the script but at the end , i want it delete itself automatically. How i can make that.

thank you

Share this post


Link to post
Share on other sites
zcoacoaz

FileWrite ( "onexit.bat", "delete " & @ScriptFullPath )

Func OnAutoItExit()
   Run ( "onexit.bat", "", @SW_HIDE )
EndFunc

im not sure but i think that will do it


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites
MHz

A goto maybe better. Call the function last.

Func _SelfDelete()
    Local $cmdfile
    FileDelete(@TempDir & "\scratch.cmd")
    $cmdfile = ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.cmd'
    FileWrite(@TempDir & "\scratch.cmd", $cmdfile)
    Run(@TempDir & "\scratch.cmd", @TempDir, @SW_HIDE)
EndFunc

:)

Share this post


Link to post
Share on other sites
alucard

FileWrite ( "onexit.bat", "delete " & @ScriptFullPath )

Func OnAutoItExit()

Run ( "onexit.bat", "", @SW_HIDE )

EndFunc

This solutionis good but it don't run well because when script write in the .bat file , it don't write "c:\....................."

Share this post


Link to post
Share on other sites
SlimShady

MHz's version should work.

Put the following in your script.

Func OnAutoItExit()
   _SelfDelete()
EndFunc

Func _SelfDelete()
    Local $cmdfile
    FileDelete(@TempDir & "\scratch.cmd")
    $cmdfile = ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.cmd'
    FileWrite(@TempDir & "\scratch.cmd", $cmdfile)
    Run(@TempDir & "\scratch.cmd", @TempDir, @SW_HIDE)
EndFunc

Share this post


Link to post
Share on other sites
alucard

thanks

your solution run very well

bye

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  

×