【问题标题】:Program running in administrative mode needs to run another application in non-administrative mode?以管理模式运行的程序需要以非管理模式运行另一个应用程序吗?
【发布时间】:2013-09-11 10:11:20
【问题描述】:

我有一个以管理模式运行的程序。该程序应该运行另一个应用程序。由于我的应用程序以管理模式运行,因此新应用程序也以管理模式运行。如何在非管理模式下运行这个新应用程序?

【问题讨论】:

    标签: c# administrative


    【解决方案1】:

    你想要的是 Process.Start 传递一个 StartInfo 对象指定你想要启动进程的用户的凭据。

    Process.Start Method (ProcessStartInfo)

    这样的事情应该让你开始。 . .

    var startInfo = new System.Diagnostics.ProcessStartInfo();
    startInfo.FileName = "Myexe.exe";
    startInfo.UserName = "Myuser";
    startInfo.Password = "MyUsersPassword";
    System.Diagnostics.Process.Start(startInfo);
    

    如果您希望它以当前用户身份运行,但不是以管理员模式运行,请尝试传递当前用户凭据,我尚未对其进行测试,但它可能会工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-13
      • 2013-03-04
      • 1970-01-01
      • 2013-05-24
      • 2013-05-31
      • 2014-07-19
      • 1970-01-01
      相关资源
      最近更新 更多