Add Admin CMD Command Prompt in Windows Terminal

Share This:

Add Admin CMD Command Prompt in Windows Terminal 1

Windows Terminal is a handy new app available in the Microsoft Store – Windows Terminal that allows you to open multiple tabs of Powershell, Command Prompt (CMD), Windows Subsystem for Linux (WSL), and others. One limitation of Windows Terminal was that you couldn’t open an elevated/admin command prompt or Powershell window. While there’s not a direct way to do this, there is a workaround you can use to add the options for an admin command prompt and admin Powershell window.

Add Admin CMD Command Prompt in Windows Terminal

To get started, you’ll want to install the gsudo app from GitHub. Depending on your version of Windows, you can run:

winget install gsudo

Next, if you’re on the Windows Terminal Preview, adding the new options is a little easier than the older versions since it lets you duplicate existing entries. You can add a new profile, select to duplicate the existing Powershell and Command Prompt profiles, then make the changes mentioned below. If you want to re-order the profiles you’ll need to edit the settings.json file.

On older versions, you’ll want to open the settings.json file and manually copy and edit the entries for Powershell and Command Prompt. You’ll paste the new lines, then:

  • Edit the commandline to sudo powershell.exe (or sudo cmd.exe for Command Prompt)
  • Change a character of the GUID
  • Edit the name to something like Windows Powershell (admin)

Here’s an example:

{
                "commandline": "sudo powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell (admin)"
            },
{
                "commandline": "sudo cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt (admin)"
            },

Once you save the file, close and re-open Windows Terminal and you should see your new entries. You’ll still be prompted by UAC when you open one of the admin tabs just like you would if you opened it from the Start Menu.


Share This:

 

Leave a Reply