PATHEXT not working as expected #22002

Open
opened 2026-01-31 08:00:36 +00:00 by claunia · 4 comments
Owner

Originally created by @RadAd on GitHub (Jul 25, 2024).

Windows Terminal version

1.20.11781.0

Windows build number

10.0.22631.3880

Other Software

No response

Steps to reproduce

Using cmd.exe
Create a shortcut to "C:\Program Files\7-Zip\7z.exe" in C:\Shims\7z.exe.lnk
Add C:\Shims to PATH - set PATH=%PATH%;C:\Shims
Add .exe.lnk to PATHEXT - set PATHEXT=%PATHEXT%;.exe.lnk
execute "7z"

Expected Behavior

7z should execute.
This works on Windows 10 but doesn't work on Windows 11.
Also "where 7z" works correctly on both Windows 10 and Windows 11.

Actual Behavior

'7z' is not recognized as an internal or external command,
operable program or batch file.

Originally created by @RadAd on GitHub (Jul 25, 2024). ### Windows Terminal version 1.20.11781.0 ### Windows build number 10.0.22631.3880 ### Other Software _No response_ ### Steps to reproduce Using cmd.exe Create a shortcut to "C:\Program Files\7-Zip\7z.exe" in C:\Shims\7z.exe.lnk Add C:\Shims to PATH - set PATH=%PATH%;C:\Shims Add .exe.lnk to PATHEXT - set PATHEXT=%PATHEXT%;.exe.lnk execute "7z" ### Expected Behavior 7z should execute. This works on Windows 10 but doesn't work on Windows 11. Also "where 7z" works correctly on both Windows 10 and Windows 11. ### Actual Behavior '7z' is not recognized as an internal or external command, operable program or batch file.
claunia added the Issue-BugProduct-Cmd.exezInbox-Bug labels 2026-01-31 08:00:36 +00:00
Author
Owner

@DHowett commented on GitHub (Aug 19, 2025):

Sorry to keep this one on the backlog for so long. As I understand it, PATHEXT and Windows' general handling of file extensions is designed for only actual file extensions--not "things that begin with a dot partway into the filename"--and as such extension matching will only work for the final dotted section.

@DHowett commented on GitHub (Aug 19, 2025): Sorry to keep this one on the backlog for so long. As I understand it, PATHEXT and Windows' general handling of file extensions is designed for only _actual file extensions_--not "things that begin with a dot partway into the filename"--and as such extension matching will only work for the final dotted section.
Author
Owner

@RadAd commented on GitHub (Aug 20, 2025):

I believe you are correct, however, this is a regression from the behaviour in Windows 11 compared to Windows 10.

@RadAd commented on GitHub (Aug 20, 2025): I believe you are correct, however, this is a regression from the behaviour in Windows 11 compared to Windows 10.
Author
Owner

@DHowett commented on GitHub (Aug 20, 2025):

You know what? You're right. This regressed in 20182.1000.rs_prerelease.200728-1415 with the merge of PR !4838113.

@DHowett commented on GitHub (Aug 20, 2025): You know what? You're right. This regressed in 20182.1000.rs_prerelease.200728-1415 with the merge of PR !4838113.
Author
Owner

@DHowett commented on GitHub (Aug 20, 2025):

FWIW, we filed MSFT-58920026 to track this

@DHowett commented on GitHub (Aug 20, 2025): FWIW, we filed MSFT-58920026 to track this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22002