how to run MStest as Admin using a batch file
-
Tuesday, July 27, 2010 4:30 AM
Dear All,
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.
Thanks,
Pritam
All Replies
-
Wednesday, July 28, 2010 3:54 AMModerator
Hi,
You question is off-topic here this forum is MSBuild, so next time; please post it in proper forum.
As what you have already said, the exception means you don’t have enough rights to perform the operation; you need to launch it as administrator.
To run our bat as administrator, one way is to create a short cut, and then set the short cut to be run as administrator.
See this link for detail http://www.vistaclues.com/run-a-batch-file-as-an-administrator/
To use command line you could use Run as to start your bat file, see this http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true
Thanks
Chao
- Marked As Answer by Chao KuoModerator Tuesday, August 03, 2010 1:57 AM

