How to execute an external process from a batch

You might need to execute an external process in a batch and you’re thinking about using WinApi::shellExecute() method. Unfortunately the whole WinApi class is set to run on client. Also the method WinApi::shellExecute() is marked as client method. That why you can’t use this method to execute an external process from batch. How to execute external process then? One option is to use System.Diagnostics.Process .NET class. Here’s a short sample how to use System.Diagnostics.Process to execute an external process:

    System.Diagnostics.Process              process;
    System.Diagnostics.ProcessStartInfo     processStartInfo;

    new InteropPermission(InteropKind::ClrInterop).assert();

    process = new System.Diagnostics.Process();

    processStartInfo = new System.Diagnostics.ProcessStartInfo();
    processStartInfo.set_Arguments("Value1 Value2 Value3");





Martin F