Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Deleting application' exe

Hi!

I have an application which is a kind of setup application (it copies some files). When the setup is finished, is it possible to delete that file? I tried to call a delete function in the application, but of course the file couldn't be deleted because Windows were using it. Any suggestions?

Thanx
0
eruj
Asked:
eruj
1 Solution
 
ahalyaCommented:
The ONLY guaranteed way to do that would be to use a DOS batch file.  The best windows method, AFAIK, will leave a file in the "Temp" directory.

The following DOS File works.

Create a batch file on your form's onDestry event and Execute it as the last step  in your EXE.

The BAT will consist of the following:[literally speaking :-)]

:repeat
del "Your.EXE" > nul
if exists "Your.EXE" goto repeat
del "BATNamee.bat"<ctrl-z>

Remember the <CTRL-Z> after batname to avoid the "file missing" error.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now