Click here to Skip to main content
15,921,694 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello
any one have idea about to delete exe after installation.
for example i have a setup.exe, i need to it will be deleted after installation this exe.
i am working with VB 6.0

Posted
Updated 13-Feb-12 0:26am
Comments
kaushikjoshi 13-Feb-12 5:11am    
Any one have idea please reply me ASAP...Thanks
Maximilien 13-Feb-12 6:28am    
Why do you want to delete the setup 7
JackDingler 14-Feb-12 16:57pm    
It's not a normal situation to delete the setup.exe. How would you uninstall without it?

You may have a look at the article Self Deleting Executables [^]. This uses C++ but explains why deleting is difficult.

Another option would be to let the application that is installed by the setup program delete the setup file upon its first run. But this requires that the application knows where to find the file and that it has sufficuient rights to delete the file.

The file location can be stored in the registry at HKLM (maybe your setup program already stores some data there in the Software tree). But the registry entry can't be deleted when your application runs with user privileges. So the registry entry may stay there (it can be finally deleted by an uninstall).

You may have noticed that some applications require that they are executed with administrator privileges when started the first time after installation. This is usually done to write some registry entries in the HKLM tree and/or do the clean up for the setup. You may also use such requirements, but it's not user friendly.
 
Share this answer
 
jochen
thanks for your reply
Actually i am working on a project that's requirement that delete the setup executable file after installation.
there are other files (cab and .slt) which is deleted but..the setup.exe which installed the software is not deleted.
I need the code or idea about delete the setup.exe after installation.
i am using vb 6.0.
i think with the help of shell command and using with "wait for until process completed success fully " function we can achieve the goal.
but i do not know the flow of code for delete this exe.
 
Share this answer
 
Comments
Jochen Arndt 13-Feb-12 7:30am    
Please don't use the answer section for such comments. You may add comments or edit/update your question.

A file that is currently executed is locked by Windows and can't be deleted. Even when using a shell command, it must be started from somewhere. And the program that started the shell command can't be deleted. It's a chicken-egg problem.
kaushikjoshi 13-Feb-12 8:16am    
Thanks For your suggestion jochen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900