I use shortcut +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> Right-click Terminal > More > Run as Admin > ◀ > ENTER
- Some solutions say to use the following, but it can only open
powershell, notwt:
+X > A > ◀ > ENTER
- While others say to use the following, but it also doesn't work:
+R > SHIFT+CTRL+ENTER
How do I open Windows Terminal as Admin via a command?
510 Answers
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.
A shell in Windows Terminal [wt] can be launched/relaunched as Admin in three ways:
- Pin Windows Terminal to the Taskbar → Shift + Right-click it → Run as Administrator
- 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
- These can be added as environment variables to PowerShell profiles [
- Add
Relaunch-Adminfunction to profile, invoking withRelaunch-Adminor aliaspsadmin:# 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
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:
- Right-click on shortcut > Select Properties
- 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
7You can create a shortcut to always run Windows Terminal as administrator using this powershell script:
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Windows Terminal.lnk")
$Shortcut.TargetPath = "$env:LOCALAPPDATA\Microsoft\WindowsApps\Microsoft.WindowsTerminal_8wekyb3d8bbwe\wt.exe"
$Shortcut.Save()
$bytes = [System.IO.File]::ReadAllBytes("$Home\Desktop\Windows Terminal.lnk")
$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON
[System.IO.File]::WriteAllBytes("$Home\Desktop\Windows Terminal.lnk", $bytes)It basically creates a Windows Terminal.lnk file on your desktop, when you run it runs Windows Terminal as an administrator.
4In older versions of Windows, Run... created tasks with administrative privileges, but in Windows 10, it no longer does; however, you can do it using Task Manager:
- CTRL+SHIFT+ESC > File Menu > New task > Create task with administrative privileges
I know this is not directly related to the question, but I consider this a big improvement for people like me which needs to always run as an Administrator (please do not do it just for the sake of it, higher permissions can represent a security risk).
I always need to run PowerShell as Administrator and I only want to use Windows Terminal, which given it's restrictions cannot be configured to run always as Administrator.
I hated the need to use shortcuts and other hacks I found being suggested online, so I think I found a better solution but you have to pay the cost of a 1/2 seconds at startup.
- Locate your user profile (A profile is a Windows PowerShell ISE script that runs automatically when you start a new session) using _ $PROFILE
- Edit profile with any preferred editor _ code $PROFILE
- Adde the following code to the profile file and save it
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { $host.ui.rawui.windowtitle="Bootstrapper" Start-Process -Verb RunAs wt
} else { $Processes = Get-Process | Where-Object {$_.mainWindowTitle -eq 'Bootstrapper' -and $_.name -eq 'WindowsTerminal'} if($Processes.count -gt 0) { Stop-Process -Id $Processes[0].id }
}What the script do? You can pin Windows Terminal icon to your application bar and when you click there WT will start as non elevated user, but the profile will understand if this is the case. When you are not running as Administrator it will change the name of the window and start a new WT as administrator. The new instance will also execute the profile file and if the instance is running as Administrator, it will look for the WT named Bootstrapper and kill it. This process takes between one and two seconds, I prefer this way other than right clicking on the icon.
In Windows 10 21H1, I have done the following:
- Go to C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.9.1942.0_x64__8wekyb3d8bbwe
- note that you might need to change the Onwer for the WindowsApps folder from the folder Properties->Security->Advanced from SYSTEM to Adminstrators.
- also note that the name of the WindowsTerminal folder might change, depending on the version you're using.
- Find wt.exe and from it's properties, in Compatibility, tick the box where it says "Run as administrator". You might have to "Change settings for all users."
- Save.
- Create a shortcut of wt.exe & copy it in your C:\Windows folder
Thsi is the only thing that worked for me AND you just need to Windows+R->wt->enter to open it as admin. No Shift key required.
Also note that applying these settings to "C:\Users$env:username\AppData\Local\Microsoft\WindowsApps\wt.exe" won't work.
It still opens as non-admin, from Run or Start.
There's one thing that may or may not bug you about this. When you update Windows Terminal, the permissions of the wt.exe might break/revert to default, which means you'll need to set them back as they were.
The approach closest, in spirit, to your original request would be to place Windows Terminal as a taskbar shortcut and use Ctrl+Shift+Win+#. The # pressed should be the actual number key on the number row that corresponds to taskbar position, 1 being the leftmost position and 0 being rightmost. This will launch a new instance of the application as admin, even if an existing instance is already open.
The only issue is I'm not sure if this works prior to Windows 10.
The easiest way I did it is to:
- Go to the folder that it is installed & copy all files and folder in that directory
- Create a folder on C:\ or anywhere you have Admin rights and name it whatever you'd like.
- Paste the contents
- Create a shortcut to run as Admin
- Pin To Taskbar
This way worked best for me because some reason I had permissions issues to it in the Program Files directory.
Add a shortcut to your taskbar then Ctrl+Shift click will open as Administrator