Sign in to follow this  
Followers 0
sandman

Auto-Delete Script immediately after work is done?

5 posts in this topic

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]

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

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

Run an .exe and delete the script?

(Just a question :) )

Share this post


Link to post
Share on other sites

!!! 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]

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  
Followers 0