Run .bat as admin
Solved
-
Hello,
I want to launch a .bat script in a session that does not have admin rights,
my script contains this:
When I run this .bat, it does prompt for the Administrator user's password but opens a new command prompt and does not continue executing the commands.
I would therefore like to be able to execute these commands requiring admin rights.
P.S.: ipconfig is just an example; I can already hear the "ipconfig doesn't require elevation" comments.
Configuration: Windows 7 / Chrome 49.0.2623.112
I want to launch a .bat script in a session that does not have admin rights,
my script contains this:
runas /noprofile /user:hostname\Administrator cmd
ipconfig
When I run this .bat, it does prompt for the Administrator user's password but opens a new command prompt and does not continue executing the commands.
I would therefore like to be able to execute these commands requiring admin rights.
P.S.: ipconfig is just an example; I can already hear the "ipconfig doesn't require elevation" comments.
Configuration: Windows 7 / Chrome 49.0.2623.112
1 answer
-
Hi
runas /noprofile /user/hostname\Administrator cmd /c ipconfig
-
-
-
-
Contributor@MakaKillerHello, you didn't put the quotes
"cmd /k ipconfig"
You must absolutely include them.
Best regards -
-