An Error is emitted when passing a path, containing spaces, to the "Target a directory" [-d] command line argument. #9877

Closed
opened 2026-01-31 02:06:27 +00:00 by claunia · 3 comments
Owner

Originally created by @AceTheWiz on GitHub (Jul 27, 2020).

Environment

Microsoft Windows [Version 10.0.18362.959]
Windows Terminal Preview [Version: 1.2.2022.0]

Steps to reproduce

Launch Windows Terminal from the Start menu Win+R passing a path containing spaces as a parameter.

wt -d c:\Program Files (x86)\Microsoft\

OR with the path enclosed in quotes.

wt -d "c:\Program Files (x86)\Microsoft\"

Expected behavior

Windows Terminal should launch and open a Tab running PowerShell with the current directory set to the supplied "Target directory", passed as a parameter. In this example the current directory, in PowerShell, should be set to c:\Program Files (x86)\Microsoft\

Actual behavior

Windows Terminal opens and displays an error in a PowerShell Tab.

for the first case i.e. path without quotes.

[error 0x80070002 when launching `Files (x86)\Microsoft\']

for the second case i.e. path with quotes.

[error 0x8007010b when launching `powershell.exe']

The Tab is not usable, iaw it does not respond to any user input.

Originally created by @AceTheWiz on GitHub (Jul 27, 2020). # Environment ```none Microsoft Windows [Version 10.0.18362.959] Windows Terminal Preview [Version: 1.2.2022.0] ``` # Steps to reproduce Launch _Windows Terminal_ from the Start menu ```Win+R``` passing a path containing spaces as a parameter. ```console wt -d c:\Program Files (x86)\Microsoft\ ``` OR with the path enclosed in quotes. ```console wt -d "c:\Program Files (x86)\Microsoft\" ``` # Expected behavior _Windows Terminal_ should launch and open a _Tab_ running PowerShell with the current directory set to the supplied "Target directory", passed as a parameter. In this example the current directory, in PowerShell, should be set to ```c:\Program Files (x86)\Microsoft\``` # Actual behavior _Windows Terminal_ opens and displays an error in a PowerShell _Tab_. for the first case i.e. path without quotes. ```console [error 0x80070002 when launching `Files (x86)\Microsoft\'] ``` for the second case i.e. path with quotes. ```console [error 0x8007010b when launching `powershell.exe'] ``` The _Tab_ is not usable, iaw it does not respond to any user input.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 02:06:27 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 27, 2020):

I can't reproduce this with 1.1 or 1.2. The key, however, is the \" at the end. The \ is being used to escape the quote (and therefore corrupting the path). Either leave the \ off or use \. 😄

@DHowett commented on GitHub (Jul 27, 2020): I can't reproduce this with 1.1 or 1.2. The key, however, is the `\"` at the end. The `\` is being used to escape the quote (and therefore corrupting the path). Either leave the `\` off or use `\.` :smile:
Author
Owner

@AceTheWiz commented on GitHub (Aug 1, 2020):

I can't reproduce this with 1.1 or 1.2. The key, however, is the \" at the end. The \ is being used to escape the quote (and therefore corrupting the path). Either leave the \ off or use \. 😄

Great thanks it works. Was the only variation I didn't try.

@AceTheWiz commented on GitHub (Aug 1, 2020): > I can't reproduce this with 1.1 or 1.2. The key, however, is the `\"` at the end. The `\` is being used to escape the quote (and therefore corrupting the path). Either leave the `\` off or use `\.` 😄 Great thanks it works. Was the only variation I didn't try.
Author
Owner

@DHowett commented on GitHub (Aug 1, 2020):

Happy to help! Thanks!

@DHowett commented on GitHub (Aug 1, 2020): Happy to help! Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9877