Terminal wont open path with a space in it when using -d flag #17772

Closed
opened 2026-01-31 05:52:55 +00:00 by claunia · 2 comments
Owner

Originally created by @FANS4ever on GitHub (Jun 21, 2022).

Windows Terminal version

1.14.1451.0

Windows build number

10.0.19044.0

Other Software

PowerShell 7.2.2
Command Prompt Microsoft Windows [Version 10.0.19044.1706]

Steps to reproduce

The issue occurs when using the "-d" flag
wt.exe -d {sourcepath}
In my case {sourcepath} = "E:\Libraries\Documents\My Games\OpenMW\saves\D"

"E:\Libraries\Documents" opens without issue.

Using the "Open in Terminal" context menu option doesn't produce this issue.

Expected Behavior

Terminal opens powershell

image

Actual Behavior

Terminal doesn't open powershell

image

Originally created by @FANS4ever on GitHub (Jun 21, 2022). ### Windows Terminal version 1.14.1451.0 ### Windows build number 10.0.19044.0 ### Other Software PowerShell 7.2.2 Command Prompt Microsoft Windows [Version 10.0.19044.1706] ### Steps to reproduce The issue occurs when using the "-d" flag wt.exe -d {sourcepath} In my case {sourcepath} = "E:\Libraries\Documents\My Games\OpenMW\saves\D" "E:\Libraries\Documents" opens without issue. Using the "Open in Terminal" context menu option doesn't produce this issue. ### Expected Behavior Terminal opens powershell ![image](https://user-images.githubusercontent.com/28804715/174900274-4e5464f1-18ae-4efb-9219-3c2f820a9606.png) ### Actual Behavior Terminal doesn't open powershell ![image](https://user-images.githubusercontent.com/28804715/174900308-7db4afe1-f5c7-40a2-8259-0300d4f9be92.png)
claunia added the Needs-TriageIssue-BugNeeds-Tag-FixNeeds-Attention labels 2026-01-31 05:52:55 +00:00
Author
Owner

@DHowett commented on GitHub (Jun 21, 2022):

The important part seems to be this extra quote:

image

If you are using string interpolation to insert the directory name after -d, you will want to make sure that it doesn't end in \. That would escape the closing quote.

The trick we've been using is to always append \. to the end of any arguments we interpolate into -d.

@DHowett commented on GitHub (Jun 21, 2022): The important part seems to be this extra quote: <img width="44" alt="image" src="https://user-images.githubusercontent.com/189190/174902060-b740a284-b986-40e2-a8c9-804df7be94ea.png"> If you are using string interpolation to insert the directory name after `-d`, you will want to make sure that it doesn't end in `\`. That would escape the closing quote. The trick we've been using is to always append `\.` to the end of any arguments we interpolate into `-d`.
Author
Owner

@FANS4ever commented on GitHub (Jun 21, 2022):

The trick we've been using is to always append \. to the end of any arguments we interpolate into -d.

This seems to be the issue. I'm using Directory Opus with a custom button to open the terminal. It seems the path always ends with a "\" character. I thought i had reproduced this in the command line but after trying again it seems to be working (must have copied the path wrong during my first tests). Thank you for the quick reply. I'll close the issue.

@FANS4ever commented on GitHub (Jun 21, 2022): > The trick we've been using is to always append `\.` to the end of any arguments we interpolate into `-d`. This seems to be the issue. I'm using Directory Opus with a custom button to open the terminal. It seems the path always ends with a "\\" character. I thought i had reproduced this in the command line but after trying again it seems to be working (must have copied the path wrong during my first tests). Thank you for the quick reply. I'll close the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17772