Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Copied from here, as it's locked over there; I hope it belongs here.

Is it possible to open .lnk (windows shortcut) in a hex editor, and change the absolute shortcut path into a relative one? Can we do this in Windows? The edit command in cmd can open link files but it's difficult to read and edit. Is there any hex editor in windows that can open an .lnk file and allow me to edit it? Do I need to take it to Linux or does Linux recognize .lnk as a shortcut too?

I want to do this not only for running .exe files, but also for pointing to folders (that is, shortcut to folders). A batch file which executes explorer.exe with the target folder as parameter can do this actually, but I want to know if there is any way to actually edit the data in the .lnk file itself

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Is there any hex editor in windows that can open lnk file and allow me to edit it?

I don't see why this should be a problem for any hex editor. It might edit the source if you create a symlink or something, but unless the editor specifically has a feature to transparently resolve shortcuts and edit the source, it should work just fine for editing the .LNK itself. I just tried editing both file and dir shortcuts using HxD and had no issues. Of course, if you're looking for a hex editor that actually parses the file and allows you to modify it, you might be out of luck.

There are also command-line programs that you can use to create and modify various aspects of shortcuts, as also Visual Basic scripts.

However, all this is pointless because Windows does not support relative shortcuts in the first place, as can be seen from this Raymond Chen post (be sure to read the associated comments as well).

share|improve this answer
Watch out for the fact that .LNK files contain the target name multiple times — the long name and the 8.3 abbreviation, in 8-bit characters and 16-bit wide characters. –  Scott Dec 3 '12 at 23:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.