Jump to content

Auto-Delete Script immediately after work is done?


Recommended Posts

Hi,

I have a plan for a script that will launch a EXE and, once the EXE quits, to delete it and also delete itself. Is this possible?

Or, I have an alternative of making the EXE and script one file, if it is possible to delete itself..

The reason I am wondering is because sometimes uninstallers don't delete the program folders because they can't delete the file that's running. Is there any other way around this?

Thanks,

SANDMAN!

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

Hi,

I have a plan for a script that will launch a EXE and, once the EXE quits, to delete it and also delete itself. Is this possible?

Or, I have an alternative of making the EXE and script one file, if it is possible to delete itself..

The reason I am wondering is because sometimes uninstallers don't delete the program folders because they can't delete the file that's running. Is there any other way around this?

Thanks,

SANDMAN!

See "Q12. How can I have the script delete itself?"

http://www.autoitscript.com/forum/index.ph...st&p=253174

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Like this:

Func Uninstall()
;delete all you files here
Local $s_RemoveBat = @TempDir & "\remove.bat"
Local $h_RemoveBat = FileOpen($s_RemoveBat, 2)
FileWrite($h_RemoveBat, ":start" & @CRLF & 'del "' & @AutoItExe & '"' & @CRLF & 'IF EXIST "' & @AutoItExe & '" goto start' & @CRLF & 'del "' & $s_RemoveBat & '"')
FileClose($h_RemoveBat)
Run($s_RemoveBat, "", @SW_HIDE)
EndFunc

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

  • 4 weeks later...

!!! Are you making a virus? !!!

Run an .exe and delete the script?

(Just a question :D )

No.. I'm a good person :)

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

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