1
I created a SFX to extract some files. After the extraction, I need that the SFX file is deleted. As far as I have seen, WinRar does not offer such option. So I thought to run some DOS command -prompt (like bat).
This is my code so far (not working):
SETUP=cmd /c del /f /q "file-to-delete"
It opens the cmd, flashes and then closes...
Someone with a similar problem: http://www.msfn.org/board/topic/34506-sfx-remove-file-after-extraction/
is your
SETUP=
a WinRar directive? Ensure the full path to the file is included. – foxidrive – 2013-06-05T13:34:57.923Yes, "SETUP=" is AN winrar diretive and it allows to run a specific program after the SFX automatic extraction, which can be "Setup.exe" or "Install.exe" or "script.bat", etc... the path is fine I just can't find the way to make it works – Rafael Vidal – 2013-06-05T13:45:17.737
Your problem is that the SFX is still running, so if you try to delete it you're only going to end up with an Access Denied error. – Karan – 2013-06-06T04:42:34.167
Karan, that's not the case. Winrar have specicif directives to be used BEFORE, DURING or AFTER the exctraction process. In this case, the SETUP directive is excevuted at the ende (after SFX has finished). So there is no problem to delete the file. By the way, foxidrive has the exactly solution. Thank you by the way. – Rafael Vidal – 2013-06-06T23:32:37.083
1Hmm, wonder why
cmd
doesn't work butcmd.exe
does (with or without the full path, former is what%comspec%
contains). So all you had to do was change your code toSETUP=cmd.exe /c del /f /q "name-of-sfx"
. – Karan – 2013-06-08T00:10:35.540