I am trying to execute a command line program from within C# and direct the output to a file.
ProcessStartInfo commandPrompt = new ProcessStartInfo("cmd.exe");
commandPrompt.Arguments = "/c " + @"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe" + " -u user -pPassword database > " + @"C:\backup\database.sql";
Process backup = Process.Start(commandPrompt);
However, it creates C:\backup\database.sql, but the file is 0 bytes and nothing is written to the file. If I execute mysqldump -u user -pPassword database > C:\backup\database.sql the file is 24KB and contians the correct output.
My question, if someone can help me, is why the output is not actually being directed to the file?