System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
process.StartInfo = startInfo;
process.Start();
string strCmdText;
strCmdText= "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
System.Diagnostics.Process.Start("CMD.exe",strCmdText);
string param="java -jar -Xmx4000m train_one.jar class_funnyai.ini 12011 10";
run_cmd(param);
void run_cmd(string param)
{
var proc = new Process();
proc.StartInfo.FileName = "cmd.exe";
// set up output redirection
proc.StartInfo.RedirectStandardInput= true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.EnableRaisingEvents = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.StandardOutputEncoding = Encoding.UTF8;
// see below for output handler
proc.ErrorDataReceived += callback_data;
proc.OutputDataReceived += callback_data;
proc.Start();
using (StreamWriter sw = proc.StandardInput)
{
if (sw.BaseStream.CanWrite)
{
sw.WriteLine(param);
}
}
proc.BeginErrorReadLine();
proc.BeginOutputReadLine();
proc.WaitForExit();
}
void callback_data(object sender, DataReceivedEventArgs e)
{
Console.WriteLine(e.Data);
}