A .lnk
file in Windows is an actual file intended to be a shortcut to another file. However, I really do want to view the contents on the .lnk
file itself. I'm finding it literally impossible to do so; no matter what I try, my applications are opening the contents of the file it points to (drag/drop into text or hex editor, file | open from text or hex editor, etc.)
Is there some way I can tell a program to actually open the .lnk file instead of the file it points to?
Best Answer
Opening shortcuts
In order to edit a shortcut you obviously need to open it first, and that proves to be tricky. In some cases you can force programs into loading shortcut files by using a command-line argument:
Whether the link target or the actual shortcut file is loaded depends on the program, though. Here's a list (in no particular order) of some free hex editors which supports them out of the box:
HxD
Open dialog Yes
Drag-and-drop No
XVI32, Free Hex Editor Neo, Tiny Hexer, wxHexEditor, Hex-Editor MX, Frhed
Open dialog No
Drag-and-drop Yes
Workaround
In case you're unable to load the content of a shortcut file, you can open a command prompt and rename the
.lnk
file to a different, non-existent extension such as.lne
:If you have multiple files you can also rename all of them at once:
You will be then able to treat those shortcuts just like regular files. When you're done, make sure to rename them back to restore their usual functionality.
Additional information
A shortcut, or shell link, contains metadata information used to access a specific link target. It's parsed and interpreted by the Windows shell. From the official documentation:
Shortcuts are stored as binary files, and can't be edited using a standard text editor. A typical
.lnk
file looks something like this internally:The first twenty bytes are always the following ones:
Further reading