Jump to content
Sign in to follow this  
hankjrfan

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

Share this post


Link to post
Share on other sites

Thanks! Works great I had to make some slight modifications since it will be running on win9x machines.

$scriptpath=GetShortName(@SCRIPTFULLPATH)

and of course replace @SCRIPTFULLPATH with $scriptpath

Share this post


Link to post
Share on other sites

This worked for me:

SuiCide()
Func SuiCide()
    $scriptpath = FileGetShortName(@SCRIPTFULLPATH)
    Run(@ComSpec & " /c " & 'del /F ' & $scriptpath)
    Exit
EndFunc

Share this post


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

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...