如何编译将以管理员身份启动exe的程序 [英] How to compile program that will launch an exe as administrator

查看:67
本文介绍了如何编译将以管理员身份启动exe的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
以编程方式提升进程特权?

我想在.NET中构建一个控制台应用程序,该应用程序仅运行另一个具有提升权限的程序.这样,我可以将其指向Flash的安装exe,向指向我的"runasadmin" exe的用户发送快捷方式,然后用户可以更新Flash.

I'd like to build a console application in .NET that simply runs another program with elevated rights. That way I can point it to, say, an install exe for Flash, send a shortcut to the user pointing to my 'runasadmin' exe, and the user can update Flash.

要运行的凭据和文件名将对用户隐藏(在已编译的exe中)

The credentials and the file name to run will be hidden from the user (within the compiled exe)

这当然安全吗?但是击中数百个用户工作站的想法使我们着眼于其他选择:)

Is this secure, of course not. But the thought of hitting hundreds of users' workstations is making us look at alternatives :)

这可行吗?有人在这方面有经验吗?

Is this feasible? Anyone have experience in this area?

推荐答案

尝试Windows API调用" CreateProcessWithLogonW -我在.Net中成功使用了它.

Try the Windows API call "CreateProcessWithLogonW" - I've used this from .Net with much success.

这篇关于如何编译将以管理员身份启动exe的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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