I would like to create a script that will open a cmd prompt as admin and then run my exe, msi, or bat file.
my current scripted cmd is
msiexec.exe /i c:\temp\Cisco_Agent\CiscoAgentDesktop.msi /qn
I would like to create a script that will open a cmd prompt as admin and then run my exe, msi, or bat file.
my current scripted cmd is
msiexec.exe /i c:\temp\Cisco_Agent\CiscoAgentDesktop.msi /qn
See this TechNet article: Runas command documentation
From a command prompt:
C:\> runas /user:<localmachinename>\administrator cmd
Or, if you're connected to a domain:
C:\> runas /user:<DomainName>\<AdministratorAccountName> cmd
Take a look here to learn how to use runas
with a password automatically.
You can always walk around that one:
Create a shortcut to your script. Go to Properties - Shortcut - Advanced- Check Run as Administrator
Every time you open the shortcut you will have your .exe opened with admin privileges.