Tutorial by Examples

This example shows how Stopwatch can be used to benchmark a block of code. using System; using System.Diagnostics; public class Benchmark : IDisposable { private Stopwatch sw; public Benchmark() { sw = Stopwatch.StartNew(); } public voi...
string strCmdText = "/C copy /b Image1.jpg + Archive.rar Image2.jpg"; System.Diagnostics.Process.Start("CMD.exe",strCmdText); This is to hide the cmd window. System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo...
This method allows a command to be sent to Cmd.exe, and returns the standard output (including standard error) as a string: private static string SendCommand(string command) { var cmdOut = string.Empty; var startInfo = new ProcessStartInfo("cmd", command) { ...

Page 1 of 1