Arguments are split wrongly when files that include space in its name are dropped to shortcut #9712

Closed
opened 2026-01-31 02:01:52 +00:00 by claunia · 4 comments
Owner

Originally created by @ayamadori on GitHub (Jul 21, 2020).

Environment

Windows build number: [Version 10.0.19041.388]
Windows Terminal version (if applicable): 1.1.2021.0

Steps to reproduce

  1. Make files that include space in its name (for example, "file 1.txt", "file 2.txt")
  2. Make test.bat
@echo off
for %%f in (%*) do (
  echo %%~nxf
)
pause
  1. Make the shortcut file which link is shown below
    wt.exe new-tab test.bat
  2. Drop the files made in 1 to the shortcut made in 3
    image

Expected behavior

file 2.txt
file 1.txt

This is the same behavior as when the files made in 1 are dropped to test.bat made in 2.
image

Actual behavior

file
2.txt
file
1.txt

image

Originally created by @ayamadori on GitHub (Jul 21, 2020). # Environment ```none Windows build number: [Version 10.0.19041.388] Windows Terminal version (if applicable): 1.1.2021.0 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. Make files that include space in its name (for example, "file 1.txt", "file 2.txt") 2. Make test.bat ``` @echo off for %%f in (%*) do ( echo %%~nxf ) pause ``` 3. Make the shortcut file which link is shown below `wt.exe new-tab test.bat` 4. Drop the files made in 1 to the shortcut made in 3 ![image](https://user-images.githubusercontent.com/7036267/88250128-905ddd80-cce1-11ea-8ae3-870baadb0ef7.png) # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> ``` file 2.txt file 1.txt ``` This is the same behavior as when the files made in 1 are dropped to test.bat made in 2. ![image](https://user-images.githubusercontent.com/7036267/88073154-d5cebd80-cbb0-11ea-8871-11d3cc3fd65e.png) # Actual behavior <!-- What's actually happening? --> ``` file 2.txt file 1.txt ``` ![image](https://user-images.githubusercontent.com/7036267/88073294-fdbe2100-cbb0-11ea-8434-20d5f7420005.png)
Author
Owner

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

Actual behavior is same as test.bat in case of PowerShell script.

  • test.ps1
foreach ($a in $args) {
    $name = [System.IO.Path]::GetFileName($a)
    echo $name
}
pause
  • Shortcut
    wt new-tab pwsh -File test.ps1

  • Actual behavior
    image

@ayamadori commented on GitHub (Jul 27, 2020): Actual behavior is same as test.bat in case of PowerShell script. - test.ps1 ``` foreach ($a in $args) { $name = [System.IO.Path]::GetFileName($a) echo $name } pause ``` - Shortcut `wt new-tab pwsh -File test.ps1` - Actual behavior ![image](https://user-images.githubusercontent.com/7036267/88554888-05bf0a80-d062-11ea-9e99-5ecb06c49a33.png)
Author
Owner

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

Thanks for reporting this! It's a problem in how app execution aliases work in the windows shell. I have filed MSFT:28063992 on the team that owns this.

@DHowett commented on GitHub (Jul 31, 2020): Thanks for reporting this! It's a problem in how app execution aliases work in the windows shell. I have filed MSFT:28063992 on the team that owns this.
Author
Owner

@ayamadori commented on GitHub (Jul 19, 2021):

Windows build number: [Version 10.0.22000.71]
Windows Terminal version (if applicable): 1.10.1933.0

This seems to be fixed ;)

  • cmd

image

  • PowerShell

image

@ayamadori commented on GitHub (Jul 19, 2021): ``` Windows build number: [Version 10.0.22000.71] Windows Terminal version (if applicable): 1.10.1933.0 ``` This seems to be fixed ;) - cmd ![image](https://user-images.githubusercontent.com/7036267/126182095-226b3178-6a57-453b-b752-dd3e8272b085.png) - PowerShell ![image](https://user-images.githubusercontent.com/7036267/126182193-94540228-63a2-47eb-bc4c-0df189e347d9.png)
Author
Owner

@zadjii-msft commented on GitHub (Jul 19, 2021):

Thanks for confirming!

@zadjii-msft commented on GitHub (Jul 19, 2021): Thanks for confirming!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9712