How to run cmd with Admin privileges using command line
93,110
Solution 1
runas /profile /user:administrator “Driver:\folder\program”
For example, the administrator account is “AAA” and you want to run BBB.exe of C:\programs, you should follow these steps:
- Press Win key & R
- Input “CMD” in open box and click “OK”
- Input: runas /profile /user:AAA “C:\programs\BBB.exe” and press “Enter”
- Input the password of administrator AAA
- Press “Enter”
Hope it works.
Solution 2
You can use runas.exe /savecred /user:administrator cmd
or refer this link
Author by
Ezra09
Updated on September 18, 2022Comments
-
Ezra09 over 1 year
Is there a way to run/start cmd as administrator through the command line or a batch file programming in Windows 8?
I want to create a batch file which has administrative privileges without any prompt to the user.
-
nixda over 10 yearsHave a look at the SU question: On Windows 7, is there a command prompt line that can start cmd as an administrator?. As far as I remember you cannot bypas any UAC popup without disabling UAC completely
-
-
Vomit IT - Chunky Mess Style almost 7 yearsYou should put some additional content in this answer explaining what it is doing rather than just proving some back code mixed with VBS and no explanation leaving people that don't know this code scratching their head wondering what it does. I'd look it up and test with it regardless if it was me using it and not understanding it but you get the point.
-
G-Man Says 'Reinstate Monica' over 3 yearsIf you promote your own software on this site, you must disclose that it is yours.
-
Andry over 3 years@G-ManSays'ReinstateMonica' I don't promote or advertise anything. And this is open source, why I have to disclose an open source that it is mine?
-
G-Man Says 'Reinstate Monica' over 3 years
-
Andry over 3 years@G-ManSays'ReinstateMonica' A Windows shortcut is a binary file. I can't post here a binary file snippet. How you suppose to do that?