MSIEXEC
Microsoft Windows Installer (Windows 7/2008).
https://ss64.com/nt/msiexec.html
**********************************************************************
https://stackoverflow.com/questions/17613216/how-to-pause-cmd-before-it-close
https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true
Specify the K parameter instead of C
From Microsoft documentation:
/c : Carries out the command specified by string and then stops.
/k : Carries out the command specified by string and continues.
proc.Arguments = "/K "+ "ipconfig"
Example:
using System.Diagnostics; namespace ConsoleApplication7 { class Program { static void Main(string[] args) { string cmd = @"xcopy C:\abc\1\1.txt C:\abc\2\"; ExecuteCommand(cmd); } public static string ExecuteCommand(string command) { ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/k " + command) { UseShellExecute = false, CreateNoWindow = false, WindowStyle = ProcessWindowStyle.Maximized }; using (Process proc = new Process()) { proc.StartInfo = procStartInfo; proc.Start(); string output = proc.StandardOutput.ReadToEnd(); if (string.IsNullOrEmpty(output)) output = proc.StandardError.ReadToEnd(); return output; } } } }
No comments:
Post a Comment