Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to create a file shortcut programatically under windows?
Forum Update on Monday, May 27th 2025

How to create a file shortcut programatically under windows?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xalam
    wrote on 13 Jul 2015, 19:51 last edited by xalam
    #1

    I want to create my applications's shortcut programatically in start menu >> startup group. I also need to be deleted it based on the option in application if user doesn't want auto start feature. I see QFile::link() but could this do the job? I don't know how to use it.

    If that is not possible, is the any other way I enable auto-start my application when windows boots up?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 13 Jul 2015, 20:20 last edited by
      #2

      Hi,

      AFAIK, link is the right choice, note the requirement for Windows.

      Create a QFile for the file you want to link to, then call link and pass it the link name. The name can be the full path to were you want to have that link.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Megamouse
        wrote on 12 Feb 2022, 00:04 last edited by
        #3

        @SGaist do you happen to know if it is possible to add command line arguments to the .lnk ?

        If not, I guess it's better to use some OS specific code.

        J 1 Reply Last reply 12 Feb 2022, 06:43
        0
        • M Megamouse
          12 Feb 2022, 00:04

          @SGaist do you happen to know if it is possible to add command line arguments to the .lnk ?

          If not, I guess it's better to use some OS specific code.

          J Offline
          J Offline
          JonB
          wrote on 12 Feb 2022, 06:43 last edited by
          #4

          @Megamouse
          I would think that is not possible from a Qt call. @SGaist's QFile::link(const QString &linkName) is all there is from Qt, and that does not accept extra arguments. Plus Qt and that call is cross-platform, and UNIX soft links don't have any such arguments. So I would think you need to drop down to a Windows-specific call.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved