PowerShell unexpectedly executes documents located in $env:PATH directories as commands #12632
Labels
Issue-Question
ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
Resolution-No Activity
Issue has had no activity for 6 months or more
WG-Engine
core PowerShell engine, interpreter, and runtime
See also: #12625
Steps to reproduce
Expected behavior
The test should succeed, because the following error should be reported:
Actual behavior
foo.txt
opens in the system's default text editor, and the test fails:That is,
foo.txt
was unexpectedly looked for in the directories listed in$env:PATH
, and then invoked as a document, as if it had been passed toInvoke-Item
.I don't think users expect to invoke documents by mere file name from
$env:PATH
locations - doing so isn't useful, and, conversely, users may end up operating on different files than they expect.Note that, by contrast,
Invoke-Item foo.txt
commendably looks only in the current directory.Environment data
The text was updated successfully, but these errors were encountered: