When I set wt.exe to run a batch file or Python script and receive the filename as a parameter in the Windows shortcut, the filename will be converted to the 8.3 format short filename. #20925

Closed
opened 2026-01-31 07:27:55 +00:00 by claunia · 2 comments
Owner

Originally created by @xavierskip on GitHub (Nov 30, 2023).

Windows Terminal version

1.18.3181.0

Windows build number

10.0.19045.3693

Other Software

No response

Steps to reproduce

at first i set a windows shortcut file, the file target is wt <path>\test.bat.
image

test.bat

@echo off
echo %1
echo %~s1
echo %~f1
pause  
with wt.exe

i use this shortcut file to open a file named "a.html" , the action as i drag the file upon the shortcut file to run。
success open the terminal and show

C:\Users\Desktop\A5FAB~1.HTM
C:\Users\Desktop\A5FAB~1.HTM
C:\Users\Desktop\A5FAB~1.HTM

i want the normal and long file name, not the 8.3 short file name even if the path to the same file.

then i try a python script. i set shortcut file target as wt.exe python <path>\test.py

test.py

import sys
print(sys.argv)
e = input('End. ')
exit()

as some show this
C:\Users\Desktop\A5FAB~1.HTM

without wt.exe

then i try to remove wt.exe from the shortcut file target and use the same script try again.

shortcut file target <path>\test.bat return

C:\Users\Desktop\a.html
C:\Users\Desktop\A5FAB~1.HTM
C:\Users\Desktop\a.html

shortcut file target <path>\python.exe <path>\test.py return

C:\Users\Desktop\a.html

The results are normal now. This confuses me.

I also try those command to win+r Run command and the result was normal after all, you need to manually add the final parameter.

I'm not sure this is Windows terminal issue,It just really bothers me.

Expected Behavior

when i set windows shortcut file taget as wt.exe test.bat, i use the shortcut to open a file name "a.html" , it can show the file normal file path like: C:\Users\Desktop\a.html

Actual Behavior

but return C:\Users\Desktop\A5FAB~1.HTM

Originally created by @xavierskip on GitHub (Nov 30, 2023). ### Windows Terminal version 1.18.3181.0 ### Windows build number 10.0.19045.3693 ### Other Software _No response_ ### Steps to reproduce at first i set a windows shortcut file, the file target is `wt <path>\test.bat`. ![image](https://github.com/microsoft/terminal/assets/1214741/e7fe25b6-667a-40c8-8d4f-73551d5d14e5) test.bat ```bat @echo off echo %1 echo %~s1 echo %~f1 pause ``` ##### with wt.exe i use this shortcut file to open a file named "a.html" , the action as i drag the file upon the shortcut file to run。 success open the terminal and show ``` C:\Users\Desktop\A5FAB~1.HTM C:\Users\Desktop\A5FAB~1.HTM C:\Users\Desktop\A5FAB~1.HTM ``` i want the normal and long file name, not the 8.3 short file name even if the path to the same file. then i try a python script. i set shortcut file target as `wt.exe python <path>\test.py` test.py ```python import sys print(sys.argv) e = input('End. ') exit() ``` as some show this `C:\Users\Desktop\A5FAB~1.HTM`。 ##### without wt.exe then i try to remove wt.exe from the shortcut file target and use the same script try again. shortcut file target `<path>\test.bat` return ``` C:\Users\Desktop\a.html C:\Users\Desktop\A5FAB~1.HTM C:\Users\Desktop\a.html ``` shortcut file target `<path>\python.exe <path>\test.py` return ``` C:\Users\Desktop\a.html ``` The results are normal now. This confuses me. I also try those command to `win+r` Run command and the result was normal after all, you need to manually add the final parameter. I'm not sure this is Windows terminal issue,It just really bothers me. ### Expected Behavior when i set windows shortcut file taget as `wt.exe test.bat`, i use the shortcut to open a file name "a.html" , it can show the file normal file path like: `C:\Users\Desktop\a.html` ### Actual Behavior but return `C:\Users\Desktop\A5FAB~1.HTM`
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 07:27:55 +00:00
Author
Owner

@DHowett commented on GitHub (Dec 1, 2023):

Wow, excellent find! It sounded really familiar, so I did some digging.

This was filed internally (MSFT-28063992) in 2020, by me!
It was fixed shortly after, and the fix was released with the Windows 11 2022 Update (10.0.22621.0+).

We filed it because somebody else noticed that paths with spaces in them did not get quoted properly.

/dup #6991

@DHowett commented on GitHub (Dec 1, 2023): Wow, excellent find! It sounded really familiar, so I did some digging. This was filed internally (MSFT-28063992) in 2020, by me! It was fixed shortly after, and the fix was released with the Windows 11 2022 Update (10.0.22621.0+). We filed it because somebody else noticed that paths with spaces in them did not get quoted properly. /dup #6991
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Dec 1, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Dec 1, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20925