问题
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