- Local time
- 12:46 PM
- Posts
- 4,192
- OS
- Windows 11
With this batch script, you can add Windows Terminal Profiles to the context menu in File Explorer.
www.elevenforum.com
Batch:
:: Add Windows Terminal Profiles to Context Menu in Windows 11
@Echo Off
net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)
:_Start
Cls & Mode CON LINES=18 COLS=90 & Color 0E
Echo.
Echo.
Echo Type (R) to Remove Windows Terminal cascading context menu
Echo.
Echo.
Echo Type (A) to Add Open in Windows Terminal cascading context menu
Echo.
Echo.
Echo Type (P) to Add PowerShell 7 to Windows Terminal cascading context menu
Echo.
Echo.
Echo Type (W) to Add WSL to Windows Terminal cascading context menu
Set /p input=:^>
If /i Not %input%==R (Goto :_A) Else (Goto :_Remove)
:_A
If /i Not %input%==A (Goto :_B) Else (Goto :_Add)
:_B
If /i Not %input%==P (Goto :_C) Else (Goto :_PS7)
:_C
If /i Not %input%==W (Goto :_Start) Else (Goto :_WSL)
:_Add
Reg.exe add "HKCR\Directory\shell\OpenWindowsTerminalProfiles" /v "MUIVerb" /t REG_SZ /d "Open in Windows Terminal" /f
Reg.exe add "HKCR\Directory\shell\OpenWindowsTerminalProfiles" /v "SubCommands" /t REG_SZ /d "" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\01DefaultProfile" /v "MUIVerb" /t REG_SZ /d "Default Profile" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\01DefaultProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -d \"%%1\"" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\02CommandPromptProfile" /v "MUIVerb" /t REG_SZ /d "Command Prompt" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\02CommandPromptProfile" /v "Icon" /t REG_SZ /d "imageres.dll,-5323" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\02CommandPromptProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"Command Prompt\" -d \"%%1\"" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\03PowerShellProfile" /v "MUIVerb" /t REG_SZ /d "PowerShell" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\03PowerShellProfile" /v "Icon" /t REG_SZ /d "powershell.exe" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\03PowerShellProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"Windows PowerShell\" -d \"%%1\"" /f
Reg.exe add "HKCR\Directory\Background\shell\OpenWindowsTerminalProfiles" /v "MUIVerb" /t REG_SZ /d "Open in Windows Terminal" /f
Reg.exe add "HKCR\Directory\Background\shell\OpenWindowsTerminalProfiles" /v "SubCommands" /t REG_SZ /d "" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\01DefaultProfile" /v "MUIVerb" /t REG_SZ /d "Default Profile" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\01DefaultProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -d \"%%V\"" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\02CommandPromptProfile" /v "MUIVerb" /t REG_SZ /d "Command Prompt" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\02CommandPromptProfile" /v "Icon" /t REG_SZ /d "imageres.dll,-5323" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\02CommandPromptProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"Command Prompt\" -d \"%%V\"" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\03PowerShellProfile" /v "MUIVerb" /t REG_SZ /d "PowerShell" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\03PowerShellProfile" /v "Icon" /t REG_SZ /d "powershell.exe" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\03PowerShellProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"Windows PowerShell\" -d \"%%V\"" /f
Exit
:_PS7
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\07PowerShell7Profile" /v "MUIVerb" /t REG_SZ /d "PowerShell 7" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\07PowerShell7Profile" /v "Icon" /t REG_SZ /d "pwsh.exe" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\07PowerShell7Profile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"PowerShell\" -d \"%%1\"" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\07PowerShell7Profile" /v "MUIVerb" /t REG_SZ /d "PowerShell 7" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\07PowerShell7Profile" /v "Icon" /t REG_SZ /d "pwsh.exe" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\07PowerShell7Profile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"PowerShell\" -d \"%%V\"" /f
Exit
:_WSL
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\05WSLProfile" /v "MUIVerb" /t REG_SZ /d "Ubuntu" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\05WSLProfile" /v "Icon" /t REG_SZ /d "wsl.exe" /f
Reg.exe add "HKCR\Directory\Shell\OpenWindowsTerminalProfiles\shell\05WSLProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"Ubuntu\" -d \"%%1\"" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\05WSLProfile" /v "MUIVerb" /t REG_SZ /d "Ubuntu" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\05WSLProfile" /v "Icon" /t REG_SZ /d "wsl.exe" /f
Reg.exe add "HKCR\Directory\Background\Shell\OpenWindowsTerminalProfiles\shell\05WSLProfile\command" /ve /t REG_SZ /d "cmd.exe /c start wt.exe -p \"Ubuntu\" -d \"%%V\"" /f
Exit
:_Remove
Reg.exe delete "HKCR\Directory\shell\OpenWindowsTerminalProfiles" /f
Reg.exe delete "HKCR\Directory\Background\shell\OpenWindowsTerminalProfiles" /f
Exit

Add "Open in Windows Terminal" expandable context menu in Windows 11
This tutorial will show you how to add or remove a custom Open in Windows Terminal expandable context menu for all users in Windows 11. Windows Terminal is a modern host application for the command-line shells you already love, like Command Prompt, PowerShell, and bash (via Windows Subsystem...

Attachments
My Computer
System One
-
- OS
- Windows 11
- Computer type
- PC/Desktop
- Manufacturer/Model
- HP Pavilion
- CPU
- AMD Ryzen 7 5700G
- Motherboard
- Erica6
- Memory
- Micron Technology DDR4-3200 16GB
- Graphics Card(s)
- NVIDIA GeForce RTX 3060
- Sound Card
- Realtek ALC671
- Monitor(s) Displays
- Samsung SyncMaster U28E590
- Screen Resolution
- 3840 x 2160
- Hard Drives
- SAMSUNG MZVLQ1T0HALB-000H1