在当前用户下运行进程 [英] Run process under current user

查看:65
本文介绍了在当前用户下运行进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS 中有安装项目".在安装过程中,我启动了另一个进程:

There is "Setup project" in VS. During installation I launch another process:

System.Diagnostics.Process process = new System.Diagnostics.Process();
//fill StartInfo and run call Start()
process.Start();

如果我在 Windows 7 下运行安装程序并为Everyone"安装,则在 SYSTEM 下启动进程.如果我安装Just for me",则在当前用户下启动进程.如何始终在当前用户下启动进程?

If I run installer under Windows 7 and install for "Everyone", process start under the SYSTEM. If I install "Just for me", process start under Current user. How do I always start process under Current user?

推荐答案

我发现很简单 解决方案.您只需要创建一个新类并从此链接复制文本即可.

I have found very simple solution. All that you need it just create a new class and copy text from this link.

启动进程调用ProcessAsUser.Launch("program name");

这篇关于在当前用户下运行进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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