PDA

View Full Version : cmd script run in custom action fails



michaelpon
12-03-2004, 01:29 PM
I've set up a cmd script to run in a .EXE custom action:

Working directory: SystemFolder
Command Line: cmd.exe /C "c:\testcmd.cmd"

If testcmd.cmd pre-exists on the target system, then it is run.

If it doesn't, but I install it in the same package as the custom action and sequence the custom action to execute "After Install Files", then I get:

"Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected...."

Of course the action is not performed.

I've tried running the custom action at a later point in the sequence and still get the same result.

Any clues?

TsungH
12-03-2004, 04:45 PM
I don't see what you want to achieve. The default behavior is that setup aborts when there is an error in that type of custom action. If you want setup to continue regardless of the result, you can have Windows Installer to ignore the return code of the custom action.

RobertDickau
12-03-2004, 06:52 PM
Another issue is that you'll want to make sure to run your custom action in deferred execution, since you're launching a file that you're installing.

(The short version is, part of the Execute sequence runs in two passes, called immediate mode and deferred mode. Immediate mode is MSI making its to-do list but not making any changes; deferred mode is MSI performing its to-do list, and it's only during deferred mode that your files are transferred.)

michaelpon
12-09-2004, 05:38 PM
I think this must be the problem. How can I know if a particular sequence step falls within this multi-mode execution process?


Another issue is that you'll want to make sure to run your custom action in deferred execution, since you're launching a file that you're installing.

(The short version is, part of the Execute sequence runs in two passes, called immediate mode and deferred mode. Immediate mode is MSI making its to-do list but not making any changes; deferred mode is MSI performing its to-do list, and it's only during deferred mode that your files are transferred.)

Christopher Painter
12-09-2004, 11:05 PM
Read this web page several times until it makes sense. It's a very good resource on script execution and how MSI generates and executes its scripts at runtime.

http://www.installsite.org/pages/en/isnews/200108/