I need to call the following command from C# code: mysql.exe --user=useranme --password=password --database=base < C:\backups\data.sql
I use:
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = false;
process.StartInfo.FileName = "mysql.exe";
process.StartInfo.Arguments = "--user=useranme --password=password --database=base < C:\backups\data.sql";
process.OutputDataReceived += new DataReceivedEventHandler(delegate(object sender, DataReceivedEventArgs args)
{
Console.WriteLine(args.Data);
});
process.Start();
process.BeginOutputReadLine();
process.WaitForExit();
But it does not work as a direct entry to the command line. I see that the right part "< C:\backups\data.sql" is not executed.
Help please.