Start Command Prompt always as admin through Windows Terminal
How can I make Windows Terminal always run Command Prompt as admin so I can issue elevated commands?
Solution 1:
The command prompt will always run as admin work if the host terminal is elevated which it doesn't by default so you'll need to do it manually.
Make a new shortcut anywhere, add this link to field %LocalAppData%\Microsoft\WindowsApps\wt.exe
, click ok, set name Terminal
, and click ok.
Then go to properties and click "Advanced" and check "Run as administrator".
This will make the shortcut always run the terminal as admin.
You can also Pin to Start and/or add it to the C:\Windows
directory so it can be run as a "Run Command" and through Windows Explorer
Optionally, download and set the original icon: https://raw.githubusercontent.com/microsoft/terminal/master/res/terminal.ico
Pointed out by @Ramhound:
If you would like to use this method for other UWP applications, it's a little different story. In our case, the windows terminal uses allowElevation
in its manifest file. Not all of the UWP applications use that and do not require such elevated privileges. If you really want a UWP application that doesn't support to allow elevation by default, you would need to mess with its manifest files.
Follow This Guide
Edit:
As pointed out by @user1686, -verb RunAs
will have no effect until Terminal is elevated and if it is, you don't really need the argument as it automatically launches elevated command prompt.