microsoft / microsoft/WSL

Impossible to set a startingDirectory into Windows Terminal profile generated by custom distribution

Open
#13,323 6 comments 0 reactions 1 assignee View on GitHub

@OneBlue is already working on this.

Since Aug 4, 2025.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

10.0.22631.5624

### WSL Version

2.5.9.0

### Are you using WSL 1 or WSL 2?

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

6.6.87.2-1

### Distro Version

custom distribution based on archlinux

### Other Software

Windows Terminal: 1.22.11141.0

### Repro Steps

1. Create a custom distribution of WSL with a custom template for the Windows terminal with `windowsterminal.profileTemplate` from /etc/wsl-distribution.conf. Configure a custom startingDirectory

```json
{
"profiles": [
{
"startingDirectory": "/home/user/folder"
}
]
}
```
3. Import the distribution
4. Impossible to set the `/home/user/folder` as starting directory

### Expected Behavior

It should be possible to set a `startingDirectory` in the generated Windows Terminal profile.

### Actual Behavior

It is impossible making Windows Terminal crash and impossible to start WSL in it.
I assume it is because `--cd ~` is used in the `commandLine` which start WSL making impossible to override it.

It is impossible to override this `commandLine` since it seems to is generated. We can change it manually in the option but I assume it should works out o the box whithout change of the generated profile.

It could better to not add `--cd ~` option in to command line and set it with `startingDirectory` option making it possible to override.

### Diagnostic Logs

Erreur generated into Windozs Terminal

[erreur 2147942667 (0x8007010b) lors du lancement de `C:\WINDOWS\system32\wsl.exe --distribution-id {408f26c4-7b8a-4f99-8f10-9043f303b51e} --cd ~']
Le démarrage du répertoire n’est pas accessible «/home/user/folder»

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.