5

In Qt I know you can create a shortcut (lnk) using the following method

QFile::link("myapp.exe", "myapp.exe.lnk");

This works fine but I want to create an lnk that also has some arguments in the target path. Anyway to do this in Qt?

Kal
  • 2,239
  • 6
  • 36
  • 74
  • 1
    Suggested edit? This comment is not constructive nor adds any additional information to the original problem and/or solution. – Kal Feb 06 '17 at 10:29

1 Answers1

3

I found the following answer from Constantin Makshin in the Qt-interest mailing list:

QFile::link() function creates symbolic links (speaking in terms of
Unix-like systems) and Windows shortcuts is only a more or less equal
solution. And since symbolic links don't support command line arguments
(they are simply "the same file with different name"), QFile::link()
doesn't support them either.

So you'll have to rely on native API to create such shortcuts/links.

Apart from using the native API, you could also create a .bat file and store the command line call in there.

Tim Meyer
  • 12,210
  • 8
  • 64
  • 97