Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt/Win Creating app shortcuts

Tags:

c++

windows

qt

lnk

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?

like image 284
Kal Avatar asked Oct 22 '22 19:10

Kal


1 Answers

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.

like image 69
Tim Meyer Avatar answered Oct 27 '22 09:10

Tim Meyer