You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows has shortcut files for launching programs or opening files. They have the extension .lnk and contain a reference to the target as well as some other properties (such as icon path, working directory etc.). A similar concept in Unix land are Desktop Entries (.desktop).
It's very common to use shortcuts on Windows (e.g. the Desktop is usually full of them) and users expect that they can open a shortcut to execute whatever it points to.
Shortcut files are not directly executable with CreateProcessW, so you cannot open a shortcut with Process.run (not even with shell: true, which doesn't really do anything on Windows; ref #9030).
I'm not sure what we could make out of this. Whether there can be a good and simple solution, or a one better than prefixing the file path with cmd /c.
Maybe this issue can draw some ideas on the matter.
The text was updated successfully, but these errors were encountered:
This has come up in Gitter chat.
Windows has shortcut files for launching programs or opening files. They have the extension
.lnk
and contain a reference to the target as well as some other properties (such as icon path, working directory etc.). A similar concept in Unix land are Desktop Entries (.desktop
).It's very common to use shortcuts on Windows (e.g. the Desktop is usually full of them) and users expect that they can open a shortcut to execute whatever it points to.
Shortcut files are not directly executable with
CreateProcessW
, so you cannot open a shortcut withProcess.run
(not even withshell: true
, which doesn't really do anything on Windows; ref #9030).They can be opened in
cmd
orpowershell
So going though
cmd /c
provides a solution, but it feels a bit hacky.The Win32 API has a native way to open files, which supports shortcuts:
ShellExecuteA
& co. These functions also provide other operations.The following example shows how the
ShellExecuteExW
function can be used to open a file (which may be a shortcut):I'm not sure what we could make out of this. Whether there can be a good and simple solution, or a one better than prefixing the file path with
cmd /c
.Maybe this issue can draw some ideas on the matter.
The text was updated successfully, but these errors were encountered: