创建桌面快捷方式
1 2 3 4
| static void addLinkToDeskTop(const QString& filename,const QString& name) { QFile::link(filename, QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).append("/").append(name+".lnk")); }
|
删除桌面快捷方式
1 2 3 4 5 6 7
| static bool delDeskTopLink(const QString& name) { QString fileName = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).append("/").append(name+".lnk"); if(QFile::exists(fileName)) return QFile::remove(fileName); return false; }
|
其中fileName 为应用程序的程序名 如:C:\test\test.exe
参考:https://blog.csdn.net/xzpblog/article/details/75172928