如何在Vista中以编程方式运行(启动)提升的命令提示符 [英] How to Run(launch) elevated command prompt programmatically in Vista

查看:72
本文介绍了如何在Vista中以编程方式运行(启动)提升的命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从批处理文件中安装一些文件(通过代码). 但是,该命令仅应在Vista和Windows 7中作为提升的命令"运行 有什么办法可以通过编程来完成吗?

I'm trying to install some files from a batch file (through code). However the command should only run as "elevated command" in Vista and Windows 7 Is there any way this can be done programitically?

我通过调用VC ++/MFC代码中的"CreateProcess"来启动批处理文件.

I'm launching the batch file by calling "CreateProcess" in VC++/MFC code.

谢谢

推荐答案

ShellExecute(NULL, L"runas", ...);

无论出于何种原因,"runas"动词都不是已在MSDN中记录,但是...

For whatever reason the "runas" verb isn't documented in MSDN but...

这篇关于如何在Vista中以编程方式运行(启动)提升的命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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