Here is the problem: ipconfig is not a "command", this is a regular application. So, "CMD.EXE" is totally redundant and should not be used.
The same goes for data files with file types registered for use with certain application, so the shell API knows about them. In all such cases, you just use
System.Diagnostics.Process.Start
with the file name and command line parameters. For example:
System.Diagnostics.Process.Start("ipconfig.ехе", "/allcompartments");
The remaining problem is using redirected streams
StandardOutput
and, just in case,
StandardError
. The use of redirection is demonstrated on these MSDN pages:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standarderror.aspx[
^].
See also:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[
^].
—SA