This question has already been answered:
Command 1 is executed in powershell
Dism /online /Get-FeatureInfo /FeatureName:TFTP
In the c # application, nothing is done, the console opens and nothing else happens:
ProcStartargs("powershell", "-command \" Dism /online /Get-FeatureInfo /FeatureName:TFTP \""); public static void ProcStartargs(string name, string args) { try { var proc = new Process { StartInfo = new ProcessStartInfo { FileName = name, Arguments = args, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, StandardOutputEncoding = Encoding.GetEncoding(866) } }; proc.Start(); // ReSharper disable once NotAccessedVariable string line = null; while (!proc.StandardOutput.EndOfStream) { line += Environment.NewLine + proc.StandardOutput.ReadLine(); } proc.WaitForExit(); } catch (Exception ex) { } }
Team 2 doesn't work either
ProcStartargs("powershell", "-command \" Dism /Mount-Image/ ImageFile:d:\\_images\\install.wim /Index:1 /mountdir:d:\\_images\\_test \"");