如何使用批处理文件以管理员身份运行 MStest

发布于 2024-09-11 04:50:06 字数 292 浏览 1 评论 0原文

我正在尝试使用批处理文件运行一些自动化测试。我已经在 VSTS 2008 中编写了所有这些测试用例。当我使用 VS IDE 运行这些测试用例时,它运行成功。但是,一旦我尝试使用批处理文件运行测试用例,它就会抛出错误“System.ComponentModel.Win32Exception:请求的操作需要提升”。

根据我的理解,如果我们可以以管理员身份运行 VS 命令提示符,这将解决我的问题。那么你能帮我“如何从批处理文件中以管理员身份运行 VS cmd”吗?我已经使用过这个 runas /user:\username cmd 但它不能解决我的问题。

I'm trying to run some automated test using a batch file. I have written all these test cases in VSTS 2008. When I run these test cases using VS IDE, it ran succesfully. But once I try to run my test case using a batch file, it throws error "System.ComponentModel.Win32Exception: The requested operation requires elevation."

As per my understanding if we can run the VS command prompt as admin, this will solve my problem. So could you please help me "how I can run the VS cmd as admin from a batch file". I have already used this runas /user:\username cmd but it doesn't solve my problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野却迷人 2024-09-18 04:50:06

我得到了答案---我已经创建了批处理文件。然后我创建该批处理文件的一个快捷方式。然后在这个快捷方式文件的高级属性中,我将其设置为以管理员身份打开。这样就解决了我的问题。所有测试用例从批处理文件运行良好。

I got my answer---I have created the batch file. And then I create one shortcut of this batch file. And then in the advanced properties of this shortcut file I set it to open as admin. In this way it solved my problem. And all test cases running fine from batch file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文