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)
{
...