如何从命令行以管理员身份运行应用程序 (TestComplete) [英] How do I run an app (TestComplete) as Administrator from the command line

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

问题描述

场景....

我正在编写一个 powershell 脚本来自动化一些 UI 测试,我必须做很多事情,从存储库中检查代码,构建,复制安装程序,然后最后我想运行 TestComplete 和测试安装程序 UI...

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...

安装程序在写入程序文件、注册表等时以提升模式运行,因此,为了让我在 TestComplete 中的测试脚本看到 msiexec 进程,TestComplete 也需要提升运行.如何从命令行执行此操作?我似乎无法使用 runas 执行此操作,1/它只是以用户(具有管理员权限)的身份运行应用程序,但实际上并未提升,2/我无法在脚本中提供密码.

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.

有什么想法吗?

推荐答案

您可以像这样使用 Start-Process cmdlet 来运行 elevatd 脚本:

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

Start-Process <some_exe> -Verb runas

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

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