Sumit Gupta
Sumit Gupta

Reputation: 569

how to launch command prompt as administrator using batch file

I am having a NUnit used automation framework. I was working on Windows XP previously and made a batch file to execute the complete Automation test using that batch file. But now I am using Windows 7 and when i tried to run same batch file, the Nunit is not launching. but when i tried to manually launch the command prompt as administrator, my execution is working fine.

Do anyone know how to launch command prompt as administrator through batch file

Upvotes: 0

Views: 6359

Answers (1)

Pradeep
Pradeep

Reputation: 3468

You can try following in your batch file: runas /user:machinename\administrator cmd OR runas /user:domain\user cmd

Both of the above will prompt for password.

For more details you can refer to usage of "RUNAS"

Upvotes: 0

Related Questions