Archive: Extracting a file from Zip2Exe file


Extracting a file from Zip2Exe file
Hi, I'm new to NSIS and am running into a problem trying to extract a file from our zip2exe installer. What I'm trying to do is get a file out of the exe prior to the main install so that I can run it in order to kill any of our active processes prior to upgrade.

The problem appears to be that I can't consistently identify the path to that file. I'm starting to understand how File pulls files in. 'File foo.exe' gives a file not found error during compile. 'File /r foo.exe' gives me the file, but under something like z282324.tmp which would be inconsistent and is probably not something I can capture in order to ExecWait on it (is there a variable that will capture that path so I can reference it in a script?).

My *very ugly* workaround (read: Hack of Doom) is to set the install dir to a local staging dir, install there and then on .onInstSuccess, run my process killer and then CopyFiles the files to where I want them and clean up. Ewwww! :-)

Is there any method for me to refer to a file in the exe and extract it on the fly? Or resolve this .tmp dir name w/o having do to some sort of FindFirst/Next call to track down this file?

Cheers!


SetOutPath $INSTDIR
File "local\path_to\file.ext"

Or:
File "/oname=$INSTDIR\file.ext" "local\path_to\file.ext"

You're better off not using ZipToExe for your final product if you can help it.

-Stu


Why not use the nsSCM plugin. This would allow you to Stop/Uninstall/Start your process.


Thanks! That got me running for now. I'll look at ditching the Zip2Exe stuff and writing a real script. We don't have a complicated setup, so it should be pretty easy. I'll also try to track down that plug-in.

Cheers!