문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top