Type of symlink file and readshortcut

Håkon Hægland hakon.hagland@gmail.com
Tue Jun 22 13:47:00 GMT 2021


I am on Windows 10 Home, 21H1. I am trying to understand what type of files
are generated by the "ln -s" command. According to this blog:

https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/

starting with Windows 10 Insiders build 14972, native symlinks can be
created without needing to elevate the console as administrator.

To enable this feature, go to "Windows Security" -> "For developers", and
turn on "Developer mode".

Further, according to:

https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
https://cygwin.com/cygwin-ug-net/using.html#pathnames-symlink

Cygwin "ln -s" should create a native symlink if available, and otherwise
create a .lnk shortcut files with a special header and the DOS READONLY
attribute set. I tried this, first I switched off "Developer mode" and ran:

$ echo a > a.txt
$ CYGWIN=winsymlinks:native ln -s a.txt b.lnk  # NOTE: should not create
native symlink since developer mode is not on..
$ ls -l
total 1.0K
-rw-r--r-- 1 hakon hakon 2 Jun 22 15:12 a.txt
lrwxrwxrwx 1 hakon hakon 5 Jun 22 15:17 b.lnk -> a.txt
$ readshortcut.exe -t b.lnk
readshortcut: Load failed on C:\cygwin64\home\hakon\test\symlink2\b.lnk

Why does readshortcut.exe fail to read the b.lnk file ? Are there some
other tools that can determine the type of the b.lnk file? Is it a native
symlink or a Windows shortcut file?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 34786 bytes
Desc: not available
URL: <https://cygwin.com/pipermail/cygwin/attachments/20210622/83be00cf/attachment-0001.obj>


More information about the Cygwin mailing list