iexpress

What is the condition for iexpress restart


I use iexpress.exe to quickly create a simple installer based on a batch file. The IExpress Wizards provides the option "Only restart if needed".

But how can I tell from the batch file that a restart is required? I tried using exit code 3016 as in windows updates. But that doesn't work.

BTW: I call the batch file with

cmd.exe /c my.bat

The contents of my.bat:

exit /b 3010

Solution

  • I tried to get IExpress to recognize the return code. I think you want 3010, not 3016, though. Also the command would be:

    exit 3010
    

    [No /b – we want to return an exit code from cmd, not set errorlevel].

    But it didn’t work, which makes me wonder if IExpress even bothers to check that.


    Anyhow, I did a bit of investigation with Process Monitor. Immediately after the install process runs, it seems IExpress checks the PendingFileRenameOperations registry value to see whether files have been marked for rename (or deletion). If there are any, it determines that a reboot is needed, and takes the action you specified in your SED file (eg prompt the user for a reboot; or just reboot; or nothing).

    In case you’re not familiar with it, the PendingFileRenameOperations registry value is a list of files to be moved or deleted on the next system boot.

    You can use Sysinternals MoveFile to simulate one of these scheduled-at-next-startup renames. Add movefile.exe to your IExpress archive, and add a line like this in your batch file:

    movefile.exe -accepteula foo bar
    

    The actual filenames aren’t important – just use a file that you know is certain to not exist. (As long as you didn’t change directory in the batch file, that’ll still be a file in, eg, %temp%\IXP000.TMP.)

    Note that you need to be running elevated for that (Run as administrator).

    Worked well here. IExpress pops up after each run, prompting the user to reboot.