wt does not spawn from explorer when spawned from (a \\wsl path) longer than MAX_PATH. #23376

Open
opened 2026-01-31 08:40:30 +00:00 by claunia · 1 comment
Owner

Originally created by @RokeJulianLockhart on GitHub (Jun 21, 2025).

Windows Terminal version

  1. #!/usr/bin/env pwsh
    Get-AppxPackage Microsoft.WindowsTerminal
    
  2. ResourceId        :
    InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe
    IsFramework       : False
    IsResourcePackage : False
    IsBundle          : False
    IsDevelopmentMode : False
    NonRemovable      : False
    Dependencies      : {Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64__8wekyb3d8bbwe}
    IsPartiallyStaged : False
    SignatureKind     : Store
    Status            : Ok
    

Windows build number

  1. #!/usr/bin/env pwsh
    Get-ComputerInfo | Select-Object -Property @(
    	'OsName',
    	'OsOperatingSystemSKU',
    	'OsVersion',
    	'OsBuildNumber'
    ) | Format-List
    
  2. OsName               : Microsoft Windows 11 Pro
    OsOperatingSystemSKU : 48
    OsVersion            : 10.0.26120
    OsBuildNumber        : 26120
    

Other Software

  1. Obviously, explorer.exe applies:

    1. #!/usr/bin/env pwsh
      #Requires -PSEdition 'Core'
      If ($IsWindows)
      {
      	Get-Item -Path (
      		Get-Command 'explorer' | `
      		Select-Object -ExpandProperty 'Source'
      	) | `
      	Select-Object -ExpandProperty 'VersionInfo' | `
      	Format-List
      }
      

      1

    2. OriginalFilename  : EXPLORER.EXE.MUI
      FileDescription   : Windows Explorer
      ProductName       : Microsoft® Windows® Operating System
      Comments          :
      CompanyName       : Microsoft Corporation
      FileName          : C:\Windows\explorer.exe
      FileVersion       : 10.0.26100.4441 (WinBuild.160101.0800)
      ProductVersion    : 10.0.26100.4441
      IsDebug           : False
      IsPatched         : False
      IsPreRelease      : False
      IsPrivateBuild    : False
      IsSpecialBuild    : False
      Language          : English (United Kingdom)
      LegalCopyright    : © Microsoft Corporation. All rights reserved.
      LegalTrademarks   :
      PrivateBuild      :
      SpecialBuild      :
      FileVersionRaw    : 10.0.26100.2415
      ProductVersionRaw : 10.0.26100.2415
      
  2. However, https://github.com/files-community/Files/issues/17133#issuecomment-2993670910 could also apply here:

    1. #!/usr/bin/env pwsh
      Get-AppxPackage FilesPreview
      
    2. Publisher         : CN=Yair Aichenbaum, O=Yair Aichenbaum, L=Baltimore, S=Maryland, C=US
      ResourceId        :
      InstallLocation   : C:\Program Files\WindowsApps\FilesPreview_3.9.10.0_x64__1y0xx7n9077q4
      IsFramework       : False
      IsResourcePackage : False
      IsBundle          : False
      IsDevelopmentMode : False
      NonRemovable      : False
      Dependencies      : {Microsoft.WindowsAppRuntime.1.7_7000.522.1444.0_x64__8wekyb3d8bbwe,
                          Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64__8wekyb3d8bbwe,
                          Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe}
      IsPartiallyStaged : False
      SignatureKind     : Developer
      Status            : Ok
      

Steps to reproduce

  1. Using a real Linux OS, in a BTRFS filesystem, create a path longer than MAX_PATH, like \\?\UNC\wsl.localhost\fedoraremix\mnt\rjlb_data\@{'Name'='Entities'}#.dir\@{'Status'='Commenced'; 'Name'='In Use'}#.dir\@{'Person'='Beedell'; 'Identifier'='S21AIB'}#.dir\@{'Name'='Entity-Specific'}#.dir\@{'Person'='Roke'; 'Identifier'='S1EV2L'}#.dir\@{'Name'='Technical'}#.dir.

  2. Install the .MSIXBundle from WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5:

    #!/usr/bin/env pwsh
    #Requires -PSEdition Core
    #Requires -Version 7.6
    If ($IsWindows) { Add-AppxPackage -Path "$LocationToMSIX" } # Usually, `$Env:UserProfile/Downloads`.
    
  3. On the host, execute the undermentioned:

    #!/usr/bin/env pwsh
    #Requires -PSEdition Core
    If ($IsWindows) { wmic diskdrive list brief }
    

    2

  4. When the correct filesystem has been identified:

    #!/usr/bin/env pwsh
    #Requires -PSEdition Core
    If ($IsWindows) { sudo wsl --mount \\.\PHYSICALDRIVE1 --bare }
    
  5. Likewise, on WSL:

    #!/usr/bin/env sh
    sudo lsblk -o NAME,FSTYPE,FSVER,FSAVAIL,MOUNTPOINTS
    

    This shall return output similar to the undermentioned:

    NAME   FSTYPE FSVER FSAVAIL MOUNTPOINTS
    sda    ext4   1.0
    sdb    ext4   1.0
    sdc    swap   1             [SWAP]
    sdd    ext4   1.0    954.6G /mnt/wslg/distro
                                /
    sde
    ├─sde1 vfat   FAT32
    ├─sde2 ext4   1.0
    ├─sde3 ext4   1.0
    └─sde4 btrfs           1.2T /mnt/rjlb/fedora
    

    Utilise the output to confirm that the device has been mounted into wsl, then set its path as $dev_id, and define a mount point at $path.

  6. When the correct filesystem has been identified:

    #!/usr/bin/env sh
    sudo mkdir /mnt/$path && \
    sudo mount -t btrfs -o ro /dev/$dev_id /mnt/$path
    

    3

  7. Access it via something like explorer.exe "\\?\UNC\wsl.localhost\fedoraremix\mnt\rjlb_data\@{'Name'='Entities'}#.dir\@{'Status'='Commenced'; 'Name'='In Use'}#.dir\@{'Person'='Beedell'; 'Identifier'='S21AIB'}#.dir\@{'Name'='Entity-Specific'}#.dir\@{'Person'='Roke'; 'Identifier'='S1EV2L'}#.dir\@{'Name'='Temporary'}#.dir.

  8. Invoke a context menu.

  9. Select "Open in Terminal".

Expected Behavior

wt should invoke, at that path.

Actual Behavior

Nothing occurs:

https://github.com/user-attachments/assets/3213e094-37fe-4431-b34a-363b8c7d1812

Tangential

If you're interested in whatever's occurred to those filenames depicted in the video, see https://github.com/files-community/Files/issues/17205#issue-3165260231. I can't be bothered to submit it to the graveyard that is Feedback Hub, unless it's a bug in WSL, like https://github.com/files-community/Files/issues/17205#issuecomment-2993691532 might demonstrate.

Originally created by @RokeJulianLockhart on GitHub (Jun 21, 2025). ### Windows Terminal version 1. ~~~pwsh #!/usr/bin/env pwsh Get-AppxPackage Microsoft.WindowsTerminal ~~~ 1. <blockquote> ~~~YAML ResourceId : InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe IsFramework : False IsResourcePackage : False IsBundle : False IsDevelopmentMode : False NonRemovable : False Dependencies : {Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64__8wekyb3d8bbwe} IsPartiallyStaged : False SignatureKind : Store Status : Ok ~~~ </blockquote> ### Windows build number 1. ~~~pwsh #!/usr/bin/env pwsh Get-ComputerInfo | Select-Object -Property @( 'OsName', 'OsOperatingSystemSKU', 'OsVersion', 'OsBuildNumber' ) | Format-List ~~~ 1. <blockquote> ~~~YAML OsName : Microsoft Windows 11 Pro OsOperatingSystemSKU : 48 OsVersion : 10.0.26120 OsBuildNumber : 26120 ~~~ </blockquote> ### Other Software 1. Obviously, `explorer.exe` applies: 1. ~~~pwsh #!/usr/bin/env pwsh #Requires -PSEdition 'Core' If ($IsWindows) { Get-Item -Path ( Get-Command 'explorer' | ` Select-Object -ExpandProperty 'Source' ) | ` Select-Object -ExpandProperty 'VersionInfo' | ` Format-List } ~~~ [^1] [^1]: [`stackoverflow.com/revisions/45517267/4`][1] [1]: https://stackoverflow.com/revisions/45517267/4#:~:text=(Get%2DItem%20%2DPath%20'C:%5CProgram%20Files%5CJava%5Cjdk1.8.0_144%5Cbin%5Cjava.exe').VersionInfo%20%7C,Format%2DList%20%2DForce 1. <blockquote> ~~~YAML OriginalFilename : EXPLORER.EXE.MUI FileDescription : Windows Explorer ProductName : Microsoft® Windows® Operating System Comments : CompanyName : Microsoft Corporation FileName : C:\Windows\explorer.exe FileVersion : 10.0.26100.4441 (WinBuild.160101.0800) ProductVersion : 10.0.26100.4441 IsDebug : False IsPatched : False IsPreRelease : False IsPrivateBuild : False IsSpecialBuild : False Language : English (United Kingdom) LegalCopyright : © Microsoft Corporation. All rights reserved. LegalTrademarks : PrivateBuild : SpecialBuild : FileVersionRaw : 10.0.26100.2415 ProductVersionRaw : 10.0.26100.2415 ~~~ </blockquote> 1. However, https://github.com/files-community/Files/issues/17133#issuecomment-2993670910 could also apply here: 1. ~~~pwsh #!/usr/bin/env pwsh Get-AppxPackage FilesPreview ~~~ 1. <blockquote> ~~~YAML Publisher : CN=Yair Aichenbaum, O=Yair Aichenbaum, L=Baltimore, S=Maryland, C=US ResourceId : InstallLocation : C:\Program Files\WindowsApps\FilesPreview_3.9.10.0_x64__1y0xx7n9077q4 IsFramework : False IsResourcePackage : False IsBundle : False IsDevelopmentMode : False NonRemovable : False Dependencies : {Microsoft.WindowsAppRuntime.1.7_7000.522.1444.0_x64__8wekyb3d8bbwe, Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64__8wekyb3d8bbwe, Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe} IsPartiallyStaged : False SignatureKind : Developer Status : Ok ~~~ </blockquote> ### Steps to reproduce 1. Using a real Linux OS, in a BTRFS filesystem, create a path longer than `MAX_PATH`, like `\\?\UNC\wsl.localhost\fedoraremix\mnt\rjlb_data\@{'Name'='Entities'}#.dir\@{'Status'='Commenced'; 'Name'='In Use'}#.dir\@{'Person'='Beedell'; 'Identifier'='S21AIB'}#.dir\@{'Name'='Entity-Specific'}#.dir\@{'Person'='Roke'; 'Identifier'='S1EV2L'}#.dir\@{'Name'='Technical'}#.dir`. 1. Install the `.MSIXBundle` from [`WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5`](https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/tag/42.0.5): ~~~pwsh #!/usr/bin/env pwsh #Requires -PSEdition Core #Requires -Version 7.6 If ($IsWindows) { Add-AppxPackage -Path "$LocationToMSIX" } # Usually, `$Env:UserProfile/Downloads`. ~~~ 1. On the host, execute the undermentioned: ~~~pwsh #!/usr/bin/env pwsh #Requires -PSEdition Core If ($IsWindows) { wmic diskdrive list brief } ~~~ [^wmic] [^wmic]: [`blog.bryanroessler.com/2020-12-14-btrfs-on-wsl2/`][wmic] [wmic]: https://blog.bryanroessler.com/2020-12-14-btrfs-on-wsl2/#:~:text=wmic%20diskdrive%20list%20brief 1. When the correct filesystem has been identified: ~~~pwsh #!/usr/bin/env pwsh #Requires -PSEdition Core If ($IsWindows) { sudo wsl --mount \\.\PHYSICALDRIVE1 --bare } ~~~ 1. Likewise, on WSL: ~~~sh #!/usr/bin/env sh sudo lsblk -o NAME,FSTYPE,FSVER,FSAVAIL,MOUNTPOINTS ~~~ This shall return output similar to the undermentioned: <blockquote> ~~~RS NAME FSTYPE FSVER FSAVAIL MOUNTPOINTS sda ext4 1.0 sdb ext4 1.0 sdc swap 1 [SWAP] sdd ext4 1.0 954.6G /mnt/wslg/distro / sde ├─sde1 vfat FAT32 ├─sde2 ext4 1.0 ├─sde3 ext4 1.0 └─sde4 btrfs 1.2T /mnt/rjlb/fedora ~~~ </blockquote> Utilise the output to confirm that the *device* has been mounted into `wsl`, then set its path as `$dev_id`, and define a mount point at `$path`. 1. When the correct filesystem has been identified: ~~~sh #!/usr/bin/env sh sudo mkdir /mnt/$path && \ sudo mount -t btrfs -o ro /dev/$dev_id /mnt/$path ~~~ [^ro] [^ro]: [`askubuntu.com/revisions/296342/3`][ro] [ro]: https://askubuntu.com/revisions/296342/3#content:~:text=sudo%20mount-,%2Do%20ro,-/dev/sda1%20/media/2tb 1. Access it via something like `explorer.exe "\\?\UNC\wsl.localhost\fedoraremix\mnt\rjlb_data\@{'Name'='Entities'}#.dir\@{'Status'='Commenced'; 'Name'='In Use'}#.dir\@{'Person'='Beedell'; 'Identifier'='S21AIB'}#.dir\@{'Name'='Entity-Specific'}#.dir\@{'Person'='Roke'; 'Identifier'='S1EV2L'}#.dir\@{'Name'='Temporary'}#.dir`. 1. Invoke a context menu. 1. Select "Open in Terminal". ### Expected Behavior `wt` should invoke, at that path. ### Actual Behavior Nothing occurs: https://github.com/user-attachments/assets/3213e094-37fe-4431-b34a-363b8c7d1812 #### Tangential If you're interested in whatever's occurred to those filenames depicted in the video, see https://github.com/files-community/Files/issues/17205#issue-3165260231. I can't be bothered to submit it to the graveyard that is Feedback Hub, unless it's a bug in WSL, like https://github.com/files-community/Files/issues/17205#issuecomment-2993691532 might demonstrate.
claunia added the Issue-QuestionNeeds-Tag-FixzInbox-Bug labels 2026-01-31 08:40:30 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 2, 2025):

I know this darkness.

CreateProcessW does not work for a working directory that is longer than MAX_PATH. I suspect that we are running into some variation of that, through the labyrinth that is ShellExecute.

Linking MSFT-48145169

PS>cmd
ResourceUnavailable: Program 'cmd.exe' failed to run: An error occurred trying to start process 'C:\Windows\System32\cmd.exe' with working directory '\\?\C:\Users\duhowett\AppData\Local\Temp\take1132004634\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'. The directory name is invalid.At line:1 char:1
+ cmd
+ ~~~.
PS>wt -w -1 nt
ResourceUnavailable: Program 'wt.exe' failed to run: An error occurred trying to start process 'C:\Users\duhowett\AppData\Local\Microsoft\WindowsApps\wt.exe' with working directory '\\?\C:\Users\duhowett\AppData\Local\Temp\take1132004634\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'. The directory name is invalid.At line:1 char:1
+ wt -w -1 nt
+ ~~~~~~~~~~~.

I'm going to put this one on the deep backlog while we track the internal bug. It's not likely to progress this side of 2026, but... you know.

@DHowett commented on GitHub (Jul 2, 2025): _I know this darkness._ `CreateProcessW` does not work for a working directory that is longer than `MAX_PATH`. I suspect that we are running into some variation of that, through the labyrinth that is `ShellExecute`. Linking MSFT-48145169 ``` PS>cmd ResourceUnavailable: Program 'cmd.exe' failed to run: An error occurred trying to start process 'C:\Windows\System32\cmd.exe' with working directory '\\?\C:\Users\duhowett\AppData\Local\Temp\take1132004634\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'. The directory name is invalid.At line:1 char:1 + cmd + ~~~. PS>wt -w -1 nt ResourceUnavailable: Program 'wt.exe' failed to run: An error occurred trying to start process 'C:\Users\duhowett\AppData\Local\Microsoft\WindowsApps\wt.exe' with working directory '\\?\C:\Users\duhowett\AppData\Local\Temp\take1132004634\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'. The directory name is invalid.At line:1 char:1 + wt -w -1 nt + ~~~~~~~~~~~. ``` I'm going to put this one on the deep backlog while we track the internal bug. It's not likely to progress this side of 2026, but... you know.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23376