delete folder from BAT in the folder after self-extraction

Jul 24, 2009 at 5:06 PM

All --

How can one have a BAT file delete the folder that the BAT files is in after self-extraction?

For example...

I am using the latest version and I create a self-extracting EXE, console type, and it runs a BAT file.

The BAT file is in a folder that gets create by the self-extraction.

Suppose the BAT file might be "C:\Temp\Dash08\Setup.bat".

The BAT runs fine and successfully deletes the contents "C:\Temp\Dash08\", including the BAT file itself.

However, the empty folder "C:\Temp\Dash08\" remains.

This is not a big deal and it is GEFN; but, I thought I should ask about improving our processing.

Maybe there is a way to have the self-extractor 1st run the BAT file (which is does now) and then run a DOS command (which could delete the folder for cleanup), or something like that?

What do you think?

 

This is the end of the DOS script...

rmdir "C:\Temp\Dash08" /S /Q

Coordinator
Jul 24, 2009 at 5:10 PM

If it were me, I would copy the bat file to a temp directory and run it from there.   You can have the bat file query its own directory, and if it does not match %TEMP%, then it should copy itself to %TEMP% and then invoke the copy.  When you invoke a bat from a bat, the first bat ends execution, as far as I know.

But this isn't really a zip question.  You might get better help somewhere else.