Im using Process and ProcessStartInfo to launch a cmd window with the usual redirected output etc. However i'm tring to launch a command line executable with arguments, and even though the string is correct when i echo it to the cmd, when i run it without echo i get "'C:\Program' is not a recognized as an interal or external command" as if the path isn't in quotation marks and the space is throwing it off.
Any help greatley appreciated!
static void Backup(string machinename)
{
Process p = new Process();
p.StartInfo = new ProcessStartInfo("cmd", "/c \"C:\\Program Files\\Citrix\\XenCenter\\xe.exe\" vm-export vm=" + machinename + " -s 192.168.00.00 -u root -pw Password1! filename=\"C:\\VMs\\" + machinename + ".xva\"")
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = false
};
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Console.WriteLine(output);
}