Configure Windows Terminal profile to always Launch Elevated

Shegun Babs
Shegun Babs Mon Sep 2021

Windows terminal is a multi-tabbed command-line front-end that Microsoft developed as a replacement for Windows Console. It can run any command-line app, including all Windows terminal emulators, in a separate tab.

I have configured my Windows Terminal to have my git bash run in it for simplicity sake where you do not have different Console Windows flying around my Taskbar.

Currently one can launch the entire Terminal as Administrator and every single tab will also run as Administrator.

The question now is how do you run individual tabs as Administrator.

I found and installed gsudo which can be used to elevate privilege on current tab or configured as a profile to open an elevated tab in the same window.

This is the profile for powershell

	"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
	"name": "Elevated PowerShell",
	"commandline": "powershell.exe gsudo powershell.exe -nologo",
	"hidden": false,
    "suppressApplicationTitle": true

Use "supressApplicationTitle" to remove the Administrator: label placed before the elevated tab name

To elevate git bash use the profile below

    "guid": "{3b433b11-c393-47ed-9421-bafebb058f6c}",
    "name": "Git-Bash",
    "icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
    "commandline": "gsudo bash.exe -i -l",
    "startingDirectory" : "%USERPROFILE%",

Remember to add %PROGRAMFILES%\Git\usr\bin to your path environment variables and be sure it tops the list else the system will try to execute the WSL's bash.exe .