Open miywm opened 4 weeks ago
Indeed, PowerShell doesn't support "..."
-enclosed entries in $env:PATH
in direct invocation (see below), whereas cmd.exe
does.
Note that POSIX-compatible shells such as bash
, like PowerShell, also do not support "..."
-enclosed entries.
Arguably, PowerShell and POSIX-compatible shells either should support "..."
-enclosed entries or support a way to escape the entry-separator character (which is ;
on Windows, and :
on Unix-like platforms), but they do not.
By contrast, when you use Start-Process
, as well as the [System.Diagnostics.Process]
API with UseShellExecute = $true
, which is equivalent, "..."
-enclosed entries ARE recognized.
This may come down to differences between two WinAPI functions:
CreateProcess()
as used in direct invocation and with UseShellExecute = $false
(the default) in .NET (Core) vs. ShellExecuteEx()
as used by Start-Process
by default and with UseShellExecute = $true
.Given that direct invocation in cmd.exe
(as opposed to use of the internal start
command) presumably also uses CreateProcess()
, there may be custom logic in cmd.exe
for interpreting %PATH%
.
Prerequisites
Steps to reproduce
Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response