Zend certified PHP/Magento developer

Run console program targeted by a .lnk from another shell (Powershell Core)?

I have a folder of .lnk shortcuts to CLI apps in different folders. The shortcut folder is added to PATH, and my PATHEXT contains “.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 (does not matter if 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:

  1. Create a .lnk shortcut to a native command (for example to C:/Windows/System32/PING.EXE), with a different name, so you can run it (so, maybe D:/shortcuts/lnkping.lnk)

  2. open cmd.exe, cd to shortcut directory, run .lnkping.lnk 1.1.1.1, output is inline as normal. Screenshot

  3. 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. Screenshot