Processes are started alternately. But can not be executed tk. the previous one is not complete.
public static void RemoveProvisionedAppxPackage__Name() { string[] list_names = { "Microsoft.3DBuilder_11.0.47.0_neutral_~_8wekyb3d8bbwe", "Microsoft.BingWeather_4.9.51.0_neutral_~_8wekyb3d8bbwe" }; foreach (var i in list_names) { RemoveProvisionedAppxPackage__Name2(@"/Image:z:\_images\_mount /Remove-ProvisionedAppxPackage /PackageName:" + i); }; } public static void RemoveProvisionedAppxPackage__Name2(string name) { Process MyProc = new Process(); MyProc.StartInfo.FileName = @"Dism.exe"; MyProc.StartInfo.Arguments = name; MyProc.Start(); }
MyProc.WaitForExit();stackoverflow.com/questions/3147911/wait-till-a-process-ends - Trymountforeach. - VladD