Domanda

I have used IExpress for self extractor. I want to prevent files deleting from temporary location. Is it possible or not?

if not then any other self extractor can do the same or not?

È stato utile?

Soluzione

It doesn't seem to be directly possible using IExpress, though you can work around it in a kludgy manner. There are other archivers that can do this directly; WinRAR springs to mind, though I'm sure there are more.

IExpress appears to have three modes:

  1. Extract files to a temporary directory (seems to be something like %temp%\IXP000.TMP), run an installation command, run an optional post-installation command, delete the temporary directory.

  2. Extract files; the location must either be specified on the command line, or the user will be prompted for a location. (I couldn't see any way to set the extract directory in the Wizard or the .sed file.)

  3. Create a .cab file. (But honestly, I'd just use makecab or cabarc…)

One workaround is to bundle an IExpress archive within an IExpress archive; the inner archive (which contains your actual files) is the extract-only type (2), and the outer archive (which only contains your inner archive) is the installer type (1). The outer IExpress archive has an installation command like:

cmd /c innerArchive.exe /q /t:"%temp%\persistent"

That will leave files in %temp%\persistent. (The cmd /c is needed to perform variable expansion on %temp%.)

If you actually need to run a command to install something, you can specify it as the post-install command (referencing %temp%\persistent if you're running a file from the inner archive). Again you might need cmd /c to expand that.


Another method which is perhaps more straightforward is a simple batch file:

@echo off
xcopy /y * "%temp%\persistent\"
rem Execute any other commands here...

Then you only need one IExpress archive, an installer type (1) that executes the batch file. Make sure you run it like cmd /c persist.bat – otherwise it will be executed by command.com, which is not good.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top