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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With