Jump to content
Sign in to follow this  
MarkMarkMark

Delete running script

Recommended Posts

Hej guys... can you guys explain to me how a script can delete it self?

at the end of the file it has to exit... and delete itself?

Im sure that there is a easy way for it.. like all my questions :)

-Mark.

Share this post


Link to post
Share on other sites

I find this is the best way.

Func _SelfDestruct()
  FileWrite(@scriptdir & "\doom.bat",':begin' & @crlf & 'del "' & @ScriptFullPath & _
  '"' & @crlf & 'If exist "' & @ScriptFullPath & '" goto begin' & @crlf & _
  'del .\doom.bat')
   DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", 'open', "string", @scriptdir & "\doom.bat", "string", '', "string", @scriptdir, "long", @sw_hide)
   Exit
EndFunc
Edited by Burrup

qq

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...