In Windows 11, when you right-click on any file or folder in File Explorer, you can see the option to open the file or folder in Windows Terminal. Clicking on this option will open the file or folder in the Terminal, which opens cmd or PowerShell prompt at the location of the selected file or folder. By default, Microsoft gives the Open in Terminal option in the File Explorer tab, but this option will open the terminal window in normal mode. If you need to perform administrative tasks using the terminal, you need to open it in elevated mode. Using the following method you can add Windows Terminal (Admin) to the file explorer context menu, which will open the Terminal app in elevated mode at the selected location.
Add Windows Terminal (Admin) to File explorer context menu:
The process of adding the Windows Terminal (Admin) option to the right-click context menu involves modifying the Windows Registry.
Note: Modifying the Registry is risky, and it causes irreversible damage to your OS Installation Follow the steps correctly. Friendly advice Before Modifying Registry Creating Restore Point is recommended.
Open the Notepad text editor, and copy-paste the following code in Notepad.
Windows Registry Editor Version 5.00
; Directory
[HKEY_CLASSES_ROOT\Directory\shell\WindowsTerminalAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Terminal Admin"
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile]
"MUIVerb"="Open in Terminal Admin - Default Profile"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile\command]
@="powershell.exe -WindowStyle Hidden \"Set-Location -literalPath '%V';Start-Process -Verb RunAs wt.exe -ArgumentList @('-d','.')\""
[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\02Cmd]
"MUIVerb"="Open in Terminal Admin - Command Prompt"
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\02Cmd\command]
@="powershell.exe -WindowStyle Hidden \"Set-Location -literalPath '%V';Start-Process -Verb RunAs wt.exe -ArgumentList @('-p','\"\"\"Command Prompt\"\"\"','-d','.')\""
[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\03PS]
"MUIVerb"="Open in Terminal Admin - PowerShell"
"HasLUAShield"=""
"Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\03PS\command]
@="powershell.exe -WindowStyle Hidden \"Set-Location -literalPath '%V';Start-Process -Verb RunAs wt.exe -ArgumentList @('-p','\"\"\"Windows PowerShell\"\"\"','-d','.')\""
; Directory\Background
[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminalAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Terminal Admin"
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile]
"MUIVerb"="Open in Terminal Admin - Default Profile"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile\command]
@="powershell.exe -WindowStyle Hidden \"Set-Location -literalPath '%V';Start-Process -Verb RunAs wt.exe -ArgumentList @('-d','.')\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\02Cmd]
"MUIVerb"="Open in Terminal Admin - Command Prompt"
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\02Cmd\command]
@="powershell.exe -WindowStyle Hidden \"Set-Location -literalPath '%V';Start-Process -Verb RunAs wt.exe -ArgumentList @('-p','\"\"\"Command Prompt\"\"\"','-d','.')\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\03PS]
"MUIVerb"="Open in Terminal Admin - PowerShell"
"HasLUAShield"=""
"Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\03PS\command]
@="powershell.exe -WindowStyle Hidden \"Set-Location -literalPath '%V';Start-Process -Verb RunAs wt.exe -ArgumentList @('-p','\"\"\"Windows PowerShell\"\"\"','-d','.')\""
Next, save the file as TerminalAdmin.reg on your Desktop
Double-click on the file to merge, and you’ll get one confirmation pop-up, click on Yes to confirm.
Next, restart your computer once, post restart, right-click on any file or folder you’ll see the “Open in Terminal Admin”.
If you want to remove this option just follow the below-mentioned steps.
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\WindowsTerminalAsAdmin]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminalAsAdmin]
Next, save the file as RemoveTerminalAdmin.reg on your Desktop.
Double-click on the file to merge, and you’ll get one confirmation pop-up, click on Yes to confirm.
Next, restart your computer once, post restart, “Open Windows Terminal Admin” option will be removed from the right-click context menu.
Read Also:
How to add Command Prompt admin in Right-click context menu on Windows 11?
How to Install Any Browser Using Terminal in Windows 11?