如何在后台启动进程? [英] How can I start a process in the background?

查看:252
本文介绍了如何在后台启动进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法在Google或StackOverflow上找到答案。

I can't seem to find an answer on Google or here on StackOverflow.

如何在后台(活动窗口后面)启动进程?就像,当进程启动时,它不会中断用户正在使用的当前应用程序。

How can I start a process in background (behind the active window)? Like, when the process starts, it will not interrupt the current application the user is using.

该进程不会在当前应用程序的前面弹出,它将刚开始。

The process won't pop out in front of the current application, it will just start.

这就是我正在使用的:

Process.Start(Chrome.exe);

Chrome浏览器在启动时弹出在我的应用程序前面。我如何使它在后台启动?

Chrome pops up in front of my application when it's started. How can I make it start in background?

我也尝试过:

psi = new ProcessStartInfo ("Chrome.exe");
psi.UseShellExecute = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(psi);

但是与前一个完全没有区别。

But there's no difference at all from the previous one.

谢谢。

推荐答案

尝试一下:

 Process p = new Process();
        p.StartInfo = new ProcessStartInfo("Chrome.exe");
        p.StartInfo.WorkingDirectory = @"C:\Program Files\Chrome";
        p.StartInfo.CreateNoWindow = true;
        p.Start();

此外,如果这不起作用,请尝试添加

Also, if that doesn't work, try adding

p.StartInfo.UseShellExecute = false;

这篇关于如何在后台启动进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆