|
Process iProcess = new Process();
iProcess.StartInfo.FileName = "cmd.exe";
iProcess.StartInfo.UseShellExecute = false;
iProcess.StartInfo.RedirectStandardInput = true;
iProcess.StartInfo.RedirectStandardOutput = true;
iProcess.StartInfo.RedirectStandardError = true;
iProcess.StartInfo.CreateNoWindow = false;
iProcess.Start();
iProcess.StandardInput.WriteLine("@cd C:\\Program Files\\Apache Software Foundation\\Apache Tomcat 7.0.41\\bin");
iProcess.StandardInput.AutoFlush=true;
iProcess.StandardInput.Write("@service install Tomcat7");
iProcess.StandardInput.WriteLine();
//iProcess.StandardInput.WriteLine("这里可以写多条命令");
iProcess.StandardInput.WriteLine("exit");
output = iProcess.StandardOutput.ReadToEnd();
iProcess.Close();
return output;
这个程序怎么不能实现安装系统服务呢?
|
|