AppDomain secondDomain = AppDomain.CreateDomain("New AppDomain"); secondDomain.ExecuteAssembly(otherapplictionname); otherapplicationname such as "ttt.exe"
Process ps=new Process(); ps.StartInfo.FileName=run;//exe程序的路径 ps.StartInfo.Argument=arg;//如果有参数的话 ps.Start(); 这样就可以了,如果要设窗体的表现,可以在startinfo里再设一下
psi.WindowStyle=ProcessWindowStyle.Hidden;
psi.CreateNoWindow=true;
psi.UseShellExecute = false;
Process ps=Process.Start(psi);
ProcessStartInfo psi=new ProcessStartInfo("yourexefile");
psi.WindowStyle=ProcessWindowStyle.Hidden;
psi.CreateNoWindow=true;
psi.UseShellExecute = false;
Process ps=Process.Start(psi);我试过用这种方法来打开一个.exe的文件,可是没有弹出这个文件的窗口,用ctrl+alt+del查看进程,.exe文件被用户名为asp.net调用在,可是就是没有窗口页面显示,该如何解决啊?
psi.WindowStyle=ProcessWindowStyle.Hidden;
psi.CreateNoWindow=false; //需要创建窗口,所以当然是false
psi.UseShellExecute = true; //用shell执行,所以用true
Process ps=Process.Start(psi);
secondDomain.ExecuteAssembly(otherapplictionname);
otherapplicationname such as "ttt.exe"
ps.StartInfo.FileName=run;//exe程序的路径
ps.StartInfo.Argument=arg;//如果有参数的话
ps.Start();
这样就可以了,如果要设窗体的表现,可以在startinfo里再设一下
private void Button1_Click(object sender, System.EventArgs e)
{
Process myProcess = new Process(); myProcess.StartInfo.UseShellExecute=true;
myProcess.StartInfo.FileName ="D://ZSZC//ZSZC.EXE";
myProcess.StartInfo.CreateNoWindow = false;
myProcess.Start(); }
可是就是没有弹出ZSZC.EXE这个程序的页面,怎么解决啊?
里strCmdLine是什么啊?
也就是你的Mian()函数的参数
没有可以省略
然后直接System.Diagnostics.Process.Start("XX.exe");
就可以了
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("XXX.exe");
info.WorkingDirectory = @"X:\XX\XXX\bin\Debug";
// 该应用程序所在的文件夹,全路径。
System.Diagnostics.Process.Start(info);
public static extern int CreateProcess(string lpApplicationName,
string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes,
ref SECURITY_ATTRIBUTES lpThreadAttributes, int bInheritHandles,
int dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDriectory,
ref STARTUPINFO lpStartupInfo, ref PROCESS_INFORMATION lpProcessInformation);private static int NORMAL_PRIORITY_CLASS = 32;
public void start()
{
HANDLE hProcess; //进程句柄
PROCESS_INFORMATION PI = new PROCESS_INFORMATION(); //进程信息
STARTUPINFO SI = new STARTUPINFO(); //启动信息
SECURITY_ATTRIBUTES SE1 = new SECURITY_ATTRIBUTES();
SECURITY_ATTRIBUTES SE2 = new SECURITY_ATTRIBUTES();
string temp_exe = "UnCopy.exe";
CreateProcess(temp_exe, null, ref SE1, ref SE2, 0,NORMAL_PRIORITY_CLASS,
System.IntPtr.Zero, null, ref SI, ref PI);
}
"D:\\ZSZC\\ZSZC.EXE"
private void Button1_Click(object sender, System.EventArgs e)
{
ProcessStartInfo psi=new ProcessStartInfo("增资标准.xls");
psi.WindowStyle=ProcessWindowStyle.Normal;
psi.WorkingDirectory=@"D:\\增资标准.xls";
psi.CreateNoWindow=false;
psi.UseShellExecute=true;
Process ps=Process.Start(psi); }
可还是不行啊!
process.StartInfo.CreateNoWindow = false;
process.StartInfo.FileName = "d:\\netuse.bat";
process.Start();