Context Menu command to open Ubuntu in Terminal from current director doesn't work #19775

Open
opened 2026-01-31 06:53:17 +00:00 by claunia · 0 comments
Owner

Originally created by @davidfufu on GitHub (Apr 28, 2023).

Windows Terminal version

1.16.10261.0

Windows build number

Windows 10 Enterprise LTSC
21H2
Build: 19044.2846

Other Software

No response

Steps to reproduce

I have this .reg file to create a context menu shortcut to open Terminal profiles from the current context. The Ubuntu one is opening, but not opening it at the current directory.

Windows Registry Editor Version 5.00

; Directory

[HKEY_CLASSES_ROOT\Directory\shell\WindowsTerminalAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Windows Terminal as Administrator"
"SubCommands"=""

[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile]
"MUIVerb"="Open in Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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','.')""

[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu]
"MUIVerb"="Open in Windows Terminal as Administrator - Ubuntu"
"HasLUAShield"=""
"Icon"="powershell.exe"

[HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu\command]
@="cmd.exe /c start wt.exe -p "Ubuntu 22.04.2 LTS" -d "%1""

; Directory\Background

[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminalAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Windows Terminal as Administrator"
"SubCommands"=""

[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile]
"MUIVerb"="Open in Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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','.')""

[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu]
"MUIVerb"="Ubuntu 22.04.2 LTS"
"Icon"="wsl.exe"

[HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu\command]
@="cmd.exe /c start wt.exe -p "Ubuntu 22.04.2 LTS" -d "%V""
`

Expected Behavior

I'm expecting a new Ubuntu shell window in Terminal opened at the directory I opened the context menu at.

Actual Behavior

Instead, what I get is a Ubuntu window in terminal at ~/

Originally created by @davidfufu on GitHub (Apr 28, 2023). ### Windows Terminal version 1.16.10261.0 ### Windows build number Windows 10 Enterprise LTSC 21H2 Build: 19044.2846 ### Other Software _No response_ ### Steps to reproduce I have this .reg file to create a context menu shortcut to open Terminal profiles from the current context. The Ubuntu one is opening, but not opening it at the current directory. Windows Registry Editor Version 5.00 ; Directory [HKEY_CLASSES_ROOT\Directory\shell\WindowsTerminalAsAdmin] "HasLUAShield"="" "MUIVerb"="Open in Windows Terminal as Administrator" "SubCommands"="" [HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile] "MUIVerb"="Open in Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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','.')\"" [HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu] "MUIVerb"="Open in Windows Terminal as Administrator - Ubuntu" "HasLUAShield"="" "Icon"="powershell.exe" [HKEY_CLASSES_ROOT\Directory\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu\command] @="cmd.exe /c start wt.exe -p \"Ubuntu 22.04.2 LTS\" -d \"%1\"" ; Directory\Background [HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminalAsAdmin] "HasLUAShield"="" "MUIVerb"="Open in Windows Terminal as Administrator" "SubCommands"="" [HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\01defaultProfile] "MUIVerb"="Open in Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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 Windows Terminal as Administrator - 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','.')\"" [HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu] "MUIVerb"="Ubuntu 22.04.2 LTS" "Icon"="wsl.exe" [HKEY_CLASSES_ROOT\Directory\Background\Shell\WindowsTerminalAsAdmin\shell\04Ubuntu\command] @="cmd.exe /c start wt.exe -p \"Ubuntu 22.04.2 LTS\" -d \"%V\"" ` ### Expected Behavior I'm expecting a new Ubuntu shell window in Terminal opened at the directory I opened the context menu at. ### Actual Behavior Instead, what I get is a Ubuntu window in terminal at ~/
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 06:53:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19775