I have a folder of .lnk
shortcuts to CLI apps in different folders. The shortcut folder is added to PATH
, and my PATHEXT
contains the ".lnk" extension. As a result, I can just type ffplay
in my shell, and Windows automatically finds the D:/shortcuts/ffplay.lnk
file and runs the ffplay.exe
executable it points to.
When I run ffplay
from cmd, it works as expected, outputs usage help to my terminal and exits. When I do the same from Powershell (it does not matter if it is the old powershell.exe
or new pwsh.exe
), there is no stdout output, and a new conhost window with the output appears instead.
Is it possible to make the linked commands behave as normal console program executables do?
How to reproduce:
Create a
.lnk
shortcut to a native command, for example toC:/Windows/System32/PING.EXE
, with a different name, so you can run it (so, maybeD:/shortcuts/lnkping.lnk
).Open
cmd.exe
, cd to shortcut directory, run.\lnkping.lnk 1.1.1.1
, output is inline as normal.ex. CMD Output
Open
powershell.exe
, cd to shortcut directory, run.\lnkping 1.1.1.1
- invocation immediately returns, new conhost window is open and output is displayed there.