Tab completion of Windows commands is not aligned with cross-platform "best practice"
See original GitHub issueSummary of the new feature / enhancement
According to an article on powershell.org:
On Windows, executable files have the .exe extension. On Linux/MacOS, an executable has file system permissions that mark a file as executable. If you’re searching for or running a command that could exist on all operating systems, omit the extension from the name. On Windows, PowerShell will implicitly add the .exe extension for you (it actually uses the extensions in the PATHEXT environment variable to look for commands).
The issue is that PS7 tab-completion does not follow this guideline for Windows executables. For example, typing dot[Tab]
results in dotnet.exe
, not dotnet
.
Proposed technical implementation details (optional)
Tab-completion for executables should follow the format basename
, not basename.ext
.
Either that or the extension appears, but in dark-grey.
An alternative would be to tab-complete to the basename, and a second tab would add the extension.
So robo[Tab]
gives Robocopy
, and robo[Tab][Tab]
gives Robocopy.exe
.
Issue Analytics
- State:
- Created 8 months ago
- Comments:15 (3 by maintainers)
Agreed, @jhoneill, but my point was that even if you carefully manage the scope of your strict-mode settings to avoid affecting other code - which you should always do - even your own code is at risk of breaking if you ship something with
Set-StrictMode -Latest
in effect, given that if a future PowerShell version introduces a new strict-mode version with even more stringent checks, your code may then fail those checks.The WG reviewed this issue. The tab completion is just resolving the filename. On the Windows platform, that includes the extension. Changing that behavior can be risky. If you are scripting for cross-platform scenarios it is your responsibility to handle using the proper name of the executable on the target platforms. Tab expansion was never meant to be cross-platform aware.