split-pane --startDirectory fails, -d is ignored #16703

Closed
opened 2026-01-31 05:20:06 +00:00 by claunia · 9 comments
Owner

Originally created by @ytqsl on GitHub (Feb 8, 2022).

Windows Terminal version

1.12.10334.0

Windows build number

10.0.22000.0

Other Software

PowerShell 7.2.1 as default profile

Steps to reproduce

wt sp --startDirectory C:\Users\
wt sp --startDirectory .\
wt sp -d .\

Expected Behavior

pane opens in the specified directory

Actual Behavior

wt sp -d .\: pane is opened with default pwsh location (system32 if not changed with set-location))
wt sp --startDirectory C:\Users\: [error 2147942405 (0x80070005) when launching `C:\Users']

Originally created by @ytqsl on GitHub (Feb 8, 2022). ### Windows Terminal version 1.12.10334.0 ### Windows build number 10.0.22000.0 ### Other Software PowerShell 7.2.1 as default profile ### Steps to reproduce `wt sp --startDirectory C:\Users\` `wt sp --startDirectory .\` `wt sp -d .\` ### Expected Behavior pane opens in the specified directory ### Actual Behavior `wt sp -d .\`: pane is opened with default pwsh location (system32 if not changed with set-location)) `wt sp --startDirectory C:\Users\`: [error 2147942405 (0x80070005) when launching `C:\Users\']
Author
Owner

@zadjii-msft commented on GitHub (Feb 8, 2022):

wt sp -d . will work the way you want.

It's a little weird that wt sp -d .\ starts in C:\Windows\System32, that might need some looking in to.

Otherwise, the long form of the arg you're looking for is --startingDirectory, not --startDirectory

@zadjii-msft commented on GitHub (Feb 8, 2022): `wt sp -d .` will work the way you want. It's a little weird that `wt sp -d .\` starts in `C:\Windows\System32`, that might need some looking in to. Otherwise, the long form of the arg you're looking for is [`--startingDirectory`](https://docs.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows#split-pane-command), not `--startDirectory`
Author
Owner

@ytqsl commented on GitHub (Feb 9, 2022):

Looks like -d and --startingDirectory both behave the same way currently (I typed it wrong before).

this used to work until few days ago.

@ytqsl commented on GitHub (Feb 9, 2022): Looks like -d and --startingDirectory both behave the same way currently (I typed it wrong before). [this](https://raw.githubusercontent.com/bcgov/embc-ess-mod/master/wt-responders.ps1) used to work until few days ago.
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2022):

I actually think this is fixed in main, in #13706

@zadjii-msft commented on GitHub (Aug 22, 2022): I actually think this is fixed in `main`, in #13706
Author
Owner

@ytqsl commented on GitHub (Sep 26, 2022):

Actually, I just tested with version 1.15.2524.0 + PowerShell 7.2.6, and even a simple wt -d c:\ is not working as expected - the working directory is always home. Changing the PowerShell profile to Use parent process directory made no difference.

@ytqsl commented on GitHub (Sep 26, 2022): Actually, I just tested with version 1.15.2524.0 + PowerShell 7.2.6, and even a simple `wt -d c:\` is not working as expected - the working directory is always home. Changing the PowerShell profile to `Use parent process directory` made no difference.
Author
Owner

@zadjii-msft commented on GitHub (Sep 29, 2023):

Wait is this still an issue/? I just tried a

  • wt -d C:\
  • wt sp -d C:\Users\
  • wt sp -d .\
  • wt sp -d .\ `; sp -d .\src

all from a PowerShell prompt, with 1.20.2683.0 (≅ 1.19 preview), and they all worked exactly as expected. If these aren't working on 1.19, I'm guessing we'll probably need to see your settings.json file?

@zadjii-msft commented on GitHub (Sep 29, 2023): Wait is this still an issue/? I just tried a * `wt -d C:\` * `wt sp -d C:\Users\` * `wt sp -d .\` * ```wt sp -d .\ `; sp -d .\src``` all from a PowerShell prompt, with 1.20.2683.0 (≅ 1.19 preview), and they all worked exactly as expected. If these aren't working on 1.19, I'm guessing we'll probably need to see your [settings.json file](https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#where-can-i-find-the-settings-file)?
Author
Owner

@ytqsl commented on GitHub (Sep 29, 2023):

Still the same for me: from pwsh 7.3.7, ran wt -d c:\ and a new tab is opened with ~ as the directory.
settings.zip

@ytqsl commented on GitHub (Sep 29, 2023): Still the same for me: from pwsh 7.3.7, ran `wt -d c:\` and a new tab is opened with ~ as the directory. [settings.zip](https://github.com/microsoft/terminal/files/12771163/settings.zip)
Author
Owner

@zadjii-msft commented on GitHub (Sep 29, 2023):

Hmm... does wt -p "Command Prompt" -d c:\ work as expected?

Here's an interesting question - what's in your PowerShell $profile? Maybe there's something in there that's cd-ing to ~/?

@zadjii-msft commented on GitHub (Sep 29, 2023): Hmm... does `wt -p "Command Prompt" -d c:\` work as expected? Here's an interesting question - what's in your PowerShell `$profile`? Maybe there's something in there that's `cd`-ing to `~`/?
Author
Owner

@ytqsl commented on GitHub (Sep 29, 2023):

wt -p "Command Prompt" -d c:\ worked.

Yes, I had set-location $HOME for some reason, removing this line fixed it. As it was synching using OneDrive, it also explains why it was the same behaviour in all my machines :).

Thanks, I'll close it.

@ytqsl commented on GitHub (Sep 29, 2023): `wt -p "Command Prompt" -d c:\` worked. Yes, I had `set-location $HOME` for some reason, removing this line fixed it. As it was synching using OneDrive, it also explains why it was the same behaviour in all my machines :). Thanks, I'll close it.
Author
Owner

@zadjii-msft commented on GitHub (Sep 29, 2023):

Hey that's good news! At least we got to the root cause of this (after more than a year 😅)

@zadjii-msft commented on GitHub (Sep 29, 2023): Hey that's good news! At least we got to the root cause of this (after more than a year 😅)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16703