使用 Process.Start 启动 Firefox:设置用户名和密码时 Firefox 未启动

发布于 2024-07-10 21:50:07 字数 725 浏览 11 评论 0原文

当我尝试使用 Process.Start 和 ProcessStartInfo (.NET) 启动 Firefox 时,一切似乎都工作正常。 但是,当我指定另一个帐户(用户的成员)的用户名和密码时,似乎什么也没有发生。 相同的代码在 Calc.exe 或 IE 上运行良好。 这很奇怪。 有任何想法吗?

代码如下:

System.Diagnostics.ProcessStartInfo pInfo = new System.Diagnostics.ProcessStartInfo();
pInfo.CreateNoWindow = false;
pInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pInfo.WorkingDirectory = "{WorkingDirectory}";
pInfo.Arguments = "{CommandLineArgs}";
pInfo.FileName = "{ExecutableAddress}";
pInfo.ErrorDialog = true;
pInfo.UseShellExecute = false;
pInfo.UserName = "{LimitedAccountUserName}";
pInfo.Password = "{SecureLimitedAccountPassword}";
System.Diagnostics.Process.Start(pInfo);

谢谢大家。

When I try to start Firefox using Process.Start and ProcessStartInfo (.NET) everything seems to work fine. But when I specify a username and password of another account (a member of Users), nothing seems to happen. The same code works fine with Calc.exe or IE. This is weird. Any ideas?

Here is the code:

System.Diagnostics.ProcessStartInfo pInfo = new System.Diagnostics.ProcessStartInfo();
pInfo.CreateNoWindow = false;
pInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pInfo.WorkingDirectory = "{WorkingDirectory}";
pInfo.Arguments = "{CommandLineArgs}";
pInfo.FileName = "{ExecutableAddress}";
pInfo.ErrorDialog = true;
pInfo.UseShellExecute = false;
pInfo.UserName = "{LimitedAccountUserName}";
pInfo.Password = "{SecureLimitedAccountPassword}";
System.Diagnostics.Process.Start(pInfo);

Thanks everyone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神回复 2024-07-17 21:50:07

为了使用不同的凭据加载应用程序,如果该应用程序使用用户配置文件,则 ProcessStartInfo 的 LoadUserProfile 属性应设置为 true。

In order to load an application with a different credential, if that app uses the user profile, LoadUserProfile property of the ProcessStartInfo should be set to true.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文