Open Windows Terminal as admin with WIN+R

I use shortcut Windows Key +R to run Windows Terminal [wt], but I cannot run it as Admin, which causes problems when I install something via choco.

  • To open it as Admin, I have to:
    Press Windows Key > Right-click Terminal > More > Run as Admin > > ENTER
  • Some solutions say to use the following, but it can only open powershell, not wt:
    Windows Key+X > A > > ENTER
  • While others say to use the following, but it also doesn't work:
    Windows Key+R > SHIFT+CTRL+ENTER

How do I open Windows Terminal as Admin via a command?


Solution 1:

I found a nice workaround.
If you use Chocolatey to install "sudo" you can use sudo to activate any command as admin from inside The windows terminal. It will launch a separate window (either cmd or PowerShell) and provide a UAC prompt if enabled.

Solution 2:

A shell in Windows Terminal [wt] can be launched/relaunched as Admin in three ways:

  1. Pin Windows Terminal to the Taskbar → Shift + Right-click it → Run as Administrator
  2. Relaunch as Admin from within wt:
    # Cmd:
      Powershell -Command "Start-Process cmd -Verb RunAs"
    
    # Powershell:
      Start-Process -FilePath "powershell" -Verb RunAs
    
    # Pwsh:
      Start-Process -FilePath "pwsh" -Verb RunAs
    
    • These can be added as environment variables to PowerShell profiles [$Profile]:
      • %UserProfile%\Documents\Windows Powershell\Microsoft.PowerShell_profile.ps1
      • %UserProfile%\Documents\Windows Powershell\profile.ps1

  3. Add Relaunch-Admin function to profile, invoking with Relaunch-Admin or alias psadmin:
    # Function to relaunch as Admin:
      function Relaunch-Admin { Start-Process -Verb RunAs (Get-Process -Id $PID).Path }
    
    # Alias for the function:
      Set-Alias psadmin Relaunch-Admin
    

Solution 3:

To start an executable as Admin from Run and Windows Menus, press CTRL+SHIFT+ENTER:

  • Run: WinKey+R
  • Windows Menus: Type the app's name > Right-click it > Select Open file location:
    1. Right-click on shortcut > Select Properties
    2. Shortcut tab > Advanced > Advanced Properties > Select Run as administrator
      (The app will always start as Admin from now on)

Additional options to run an app as Administrator