5

I'm running a SAMBA file store for our Windows users, and I'd like to automatically generate windows LNK files linking to other network shares that the user needs access to.

I've done quite a bit of googling and I can't find a way of creating windows links on Linux, or through Perl. I did find a perl module that looked promising in CPAN, but it will only run on Windows unfortunately.

If it's not possible to create .LNK files, perhaps there is an alternative solution people can suggest to allow the users to click on a file in one SAMBA store to be linked to a different SAMBA share?

Thanks,

Bart.

0

The binary file format is documented here: https://web.archive.org/web/20110817051855/http://www.stdlib.com/art6-Shortcut-File-Format-lnk.html It looks like you should be able to generate files like that using whatever language you want to output. I don't have a windows system handy to try out if its correct or not.

  • Unfortunately I don't have the skills to write something like this myself - but I think this probably is the only solution :( – Bart B Sep 13 '11 at 13:36
8

It's been a long time since the initial question, but I've had the same issue and found a solution.

I wrote an application whose goal is to allow anyone to create lnk files from any OS. I started writting it in bash and then I converted it in C (the sources are available).

It's still fresh, so except me nobody tested yet, but you can have a look here :
  http://www.mamachine.org/mslink/index.en.html

  • mslink.sh seems to work. Tested it with Right click + Properties on Windows 7 virtual machine. However you have to remember escaping the backslashes in shell with \` after the -l` parameter for the file to be generated properly. For instance: ./mslink.sh -l C:\\folder -o /~/Desktop/shortcut.lnk – Karmus Oct 21 '15 at 11:18
  • This is excellent and works as advertised. Thank you @mamachine! – wojtow Mar 29 '16 at 17:53
  • 1
    You can put single quotes around the argument to -l and avoid having to escape the backslashes. – wojtow Mar 29 '16 at 17:58
  • It's good but the path length is pretty limited. – Lightness Races in Orbit Jan 6 '17 at 1:24
  • @mamachine could you add a licence (ex GPL) to your work? without a licence is all rigths reserverd – Fredy SFL Aug 13 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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