I have a batch file called test.bat
.
(我有一个名为test.bat
的批处理文件。)
I am calling the below instructions in the test.bat
file: (我在test.bat
文件中调用以下说明:)
start /min powershell.exe %sysdrive%estScriptsestscript1.ps1
When I run this through the command prompt, my testscript is running successfully.
(当我通过命令提示符运行时,我的testscript运行成功。)
I want to run it as administrator (as if I have created a desktop shortcut 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.
(我已经尝试在上面的test.bat
添加/elevate
/NOUAC
和/NOUAC
参数,但没有运气。)
How do I fix this issue? (我该如何解决这个问题?)
I know how to do it manually, but I want this to be executed from the command prompt.
(我知道如何手动执行,但我希望从命令提示符执行此操作。)
(By Marnix Klooster ): ...without using any additional tools, like those suggested in an answer to Super User question How to run program from command line with elevated rights .)
((作者Marnix Klooster ):...不使用任何其他工具,例如在回答超级用户问题时建议的那些工具如何从具有提升权限的命令行运行程序 。))
ask by Praveen Jakkaraju translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…