Jump to content

Is it possible to have a script delete itself.


Recommended Posts

I would like to have a script run and on the last step delete itself. Just useing file delete does not work because the file is in use. I could call another script in the last step that deletes the origional script but I would rather not have it this way.

Any suggestions?

Thanks

Link to comment
Share on other sites

@MARK

sometimes script will be still active while your trying to delete em.

thats why there is a loop.

@LARRY

they should be locals :(

<{POST_SNAPBACK}>

I tried the below script and it still deleted itself.

SuiCide()
Func SuiCide()
    $scriptpath = FileGetShortName(@SCRIPTFULLPATH)
    Run(@ComSpec & " /c " & 'del /F ' & $scriptpath)
    Do
        Sleep(1000)
    Until 1 = 0 
EndFunc
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...