Run .bat as admin
Solved
MakaKiller
Posted messages
54
Status
Membre
-
MakaKiller Posted messages 54 Status Membre -
MakaKiller Posted messages 54 Status Membre -
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
returns a runas syntax error and displays the command configuration information.
And I can't find a /c option for runas.
tested on my machine === ok
: between user and hostname and not /
cmd /c if you want the cmd window to close
here is the result in screenshot
(for the ":" it's a transcription error in this post)
http://www.cjoint.com/c/FDomnyhAiRR
"cmd /k ipconfig"
You must absolutely include them.
Best regards
great, it works, thank you.