如何从命令提示符下以“以管理员身份运行"身份运行应用程序? [英] How to run an app as “run as administrator” from command prompt?

查看:621
本文介绍了如何从命令提示符下以“以管理员身份运行"身份运行应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为test.bat的批处理文件,我在test.bat文件中调用以下说明

启动/min powershell.exe%sysdrive%\ testScripts \ testscript1.ps1"

当我通过命令提示符运行此脚本时,我的测试脚本已成功运行.我想以管理员身份运行它(就像我已经创建了一个桌面项目并以管理员身份运行,它不应提示输入任何用户名或密码)

我尝试在上面的test.bat中添加"/elevate"和"/NOUAC"参数,但是没有运气.有人可以帮助我解决此问题吗?

我知道如何手动执行此操作,但我希望从命令提示符处执行此操作

I have a batch file called test.bat, i am calling the below instructions in test.bat file

"start /min powershell.exe %sysdrive%\testScripts\testscript1.ps1"

When i run this through the command prompt my testscript is running successfully. i want to run it as administrator(like i have created a desktop item and run as administrator, it shouldn''t prompt for any username or password)

I have tried adding "/elevate" and "/NOUAC" parameters in the above test.bat but no luck. can someone help me how to fix this issue?

I know how to do it manually but i want this to be executed from the command prompt
thanks in advance.

推荐答案

逐步介绍:
Step by step: http://www.techrepublic.com/blog/window-on-windows/tip-how-do-i-run-the-command-line-as-an-administrator-in-windows-vista/603[^].

—SA


开始>>命令提示符>>右键单击以管理员身份运行

然后运行文件
Start>>Command prompt>>right click Run as Administrator

an then run your file


您可以以管理员身份打开命令提示符,然后使用它来运行程序.
You could open the command prompt as administrator, then use it to run the program.


这篇关于如何从命令提示符下以“以管理员身份运行"身份运行应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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