如何使用批处理文件以管理员身份运行 MStest
我正在尝试使用批处理文件运行一些自动化测试。我已经在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我得到了答案---我已经创建了批处理文件。然后我创建该批处理文件的一个快捷方式。然后在这个快捷方式文件的高级属性中,我将其设置为以管理员身份打开。这样就解决了我的问题。所有测试用例从批处理文件运行良好。
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.