How can I name a batch file from MSI

I have an msi installer that needs to call several batch files to complete the installation procedure. The batch file copies additional files from the installer to several directories and then modifies the permissions for several of those directories. We want to keep using batch files because there is little time left in our development schedule. I am not using WIX.

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

Below is the code I am using to try and run a batch file from a custom action. It opens a cmd window, works for a while but doesn't seem to end. If I run the same batch files directly from the command line, 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


source to share


2 answers


I believe you need to create your own action. See this question .



+2


source


Many antivirus programs can stop .BAT files from executing during the installation process, you should really do this using standard Windows Installer functionality or as a custom C ++ action



0


source







All Articles