Creating a windows shortcut (.lnk) in Linux with spaces in the argument to a network share

2.1k views Asked by At

I am needing to use Puppet to create windows shortcuts on hosts to be accessed via SAMBA. The Puppet side I'll be fine with, it's the script I've been having issues getting working.

I've tried to use:

mslink_v3.sh on first look covers it all, with the exception of what I need to do. Similar with pylnk3.sh and lnk.sh working together, just a different reason for it not to work.

I am trying to create a windows shortcut to a network location with a argument with a space in it. Example below:

  • Path to exe = \\myhostname\program.exe
  • Argument = \\myhostname\program.ini loadabc

mslink_v3.sh will not let me surround the argument in single or double quotes, but works fine for network locations. pylnk3.sh/lnk.sh will not work for network locations, argument with spaces are ok via quotes. I did find in the end a code reference in pylink3.sh that network locations have not been implemented yet.

I've not found away to contact the developer of mslink_v3.sh to see about a tweak. I was going to comment on his post on this site, but I did not have enough points (hoping this post may give me enough).

Any suggestions at this point would be good.

Thanks

Matt

1

There are 1 answers

0
Matthew Dennison On BEST ANSWER

I contacted the developer of pylnk3.py via GitHub. He's added network support and also added all the cli support that lnk.py added.

Link below to the branch with all the development included:

https://github.com/strayge/pylnk/tree/cli_options