How do I run an app (TestComplete) as Administrator from the command line

大憨熊 提交于 2019-11-29 22:56:30

问题


Scenario....

I am writing a powershell scrip to Automate some UI Testing, there are a bunch of things that I have to do re, checking code out of a repository, building, copying installers, then at the end I want to run TestComplete and test the installer UI...

The Installer runs in elevated mode as it writes to program files, registry etc so, in order for my test script in TestComplete to see the msiexec process, TestComplete also needs to be run elevated. How do I do this from the command line? It does not appear that I can do this with runas, 1/ it just runs the app as the user (who has admin privileges) but not actually elevated and 2/ I can't supply a password in the script.

Any ideas?


回答1:


You can run a script elevatd by using the Start-Process cmdlet like so:

Start-Process <some_exe> -Verb runas


来源:https://stackoverflow.com/questions/3278505/how-do-i-run-an-app-testcomplete-as-administrator-from-the-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!