views:

430

answers:

2

I have an msi installer that needs to call a few batch files to finish the install procedure. The batch file copies extra files from the installer to a few directories and then modifies permissions on several of those directories. We want to continue using the batch files because there is not a lot of time left in our development schedule. I am not using WIX.

If possible I would like to capture the output of the batch as it goes and write it to a log file.

Found bellow is the code I am using to try to run the batch file from a custom action. It opens a cmd window, runs for a while but never seems to finish. If I run the same batch files directly from the command prompt they work.

//Set the environment to the directory containing the bat files

ProcessStartInfo info = new ProcessStartInfo(batch);
info.WindowStyle = ProcessWindowStyle.Hidden;
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardOutput = true;
if (!string.IsNullOrEmpty(argument))
   info.Arguments = argument;

Process process = new Process();
process.StartInfo = info;
process.Start();

// Capture the standard error and standard output

What am I doing wrong?

+2  A: 

I believe you'll need to create a custom action. See this question.

phoebus
I guess I just have to work harder to get it working. Thanks for your response.
smaclell
A: 

Many anti-virus programs may stop execution of .BAT files during an installation process, you should really be doing this using standard Windows Installer functionality or as a C++ Custom Action

sascha

related questions