When run via batch file, uniextract exits immediately, after which extraction occurs. The next step in the batch file generally operates on the extracted directories. That's a problem, because they don't exist yet.
A workaround for batch files is adding a fixed delay, e.g.
uniextract nsispackage.exe dir
sleep 8
(operations on dir)
The problem with this workaround is that uniextract takes a different amount of time to extract each exe. To be on the safe side, the delay must be chosen long enough that there is dead time.
Could uniextract be changed to exit when extraction is complete rather than immediately? IMHO that would make uniextract more useful for scripts.
If this change can't be made, how about adding an option to uniextract's installer to append uniextract's bin subdirectory to %path%? That way, a user could extract (for example) an nsis exe with the following code:
cmdtotal instexpl.wcx x nsispackage.exe dir
(operations on dir)
No fixed delay is needed, since cmdtotal does wait until extraction is complete before exiting.
Re: Wishlist: exit when extraction complete
This doesn't seem right. UniExtract.exe definitely continues running until extraction is complete. It has to. After extraction it does some validation stuff to ensure that it was a successful operation, deletes the log file if no errors were detected, etc. I think the issue you may be seeing is that when called from a command line, control is immediately returned to the command line rather than waiting until execution of the program is complete. This is because UniExtract is a GUI app vs. a CLI app. The same behavior occurs with any GUI app. Try running calc.exe from cmd.exe. You'll be returned to the command prompt immediately after executing it, even though Calc is still running.
I think you can work around this by using
start /wait
to launch UniExtract. This method forces batch files to wait until a GUI app has completed before continuing execution. Try something like this:start /wait uniextract.exe package.exe /sub
. I'm running Linux right now so I can't test that myself, but I think it should do what you need, without requiring that ugly sleep timer approach.--
http://www.legroom.net/
Re: Wishlist: exit when extraction complete
Thanks! You're absolutely right! Start /wait does the trick.
To help educate people like me, could it be worthwhile to add something like the following to (1) uniextract's /help dialog box and (2) "Installation and Usage" at http://www.legroom.net/software/uniextract?
Batch file usage is
start /wait uniextract [args]
, which pauses the batch file until extraction is complete.Re: Wishlist: exit when extraction complete
Hello, I had some trouble extracting large binaries (hundreds of MB) with uniextract 1.6, because of the cmdTotal timeout feature :
I searched for some kind of configuration file or CLI argument to override this, until I found the variable was hardcoded into the assembler...
If you ever find yourself in such a situation, dont panic! Here is a simple workaround :
You're all done ! :D
Maybe this could be included in a future release of uniextract? Did this tiny glitch already happened to someone before?
Anyway, thank you very much for this nice piece of software ! ;)