using System;
using System.Diagnostics;
namespace Manager
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName =@"E:/我的源码/Net/ProcessUse/AddUser/AddUser/bin/Debug/AddUser.exe";
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput =true;
psi.UseShellExecute = false; //该值指示不显示控制台
psi.Arguments= @"hello";//给出上传文件名
Process proc = Process.Start(psi);
proc.WaitForExit();//等待被调用进程结束
int retrunValue = proc.ExitCode;//读取返回值
Console.WriteLine(""+retrunValue);
}
}
}
AddUser很简单,一个控制台程序
using System;
namespace AddUser
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class AddUserTest
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static int Main(string[] args)
{
return 2;
}
}
}