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. In Qt Installer Framework, after installation is finished how do I run a batch file "with arguments"?
Forum Updated to NodeBB v4.3 + New Features

In Qt Installer Framework, after installation is finished how do I run a batch file "with arguments"?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.5k 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.
  • A Offline
    A Offline
    akhi95
    wrote on last edited by akhi95
    #1

    To open a batch file after installation is finished, we use the following code:

    Component.prototype.installationFinished = function()
    {
        QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/file.bat");     
    }
    

    But I want to send two arguments to the batch file. How can I do that? Please help.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      Why don't you use "Execute" operation?
      By using it you can even have an undo command to run when uninstalling.

      A 2 Replies Last reply
      2
      • B Bonnie

        Why don't you use "Execute" operation?
        By using it you can even have an undo command to run when uninstalling.

        A Offline
        A Offline
        akhi95
        wrote on last edited by akhi95
        #3

        @Bonnie We cannot use Execute operation in installationFinished function

        Component.prototype.installationFinished = function()
        {
        }
        

        Operations can only be added in createOperations() kind of functions which are executed during installation, not after the installation.

        1 Reply Last reply
        0
        • B Bonnie

          Why don't you use "Execute" operation?
          By using it you can even have an undo command to run when uninstalling.

          A Offline
          A Offline
          akhi95
          wrote on last edited by
          #4

          @Bonnie See this SO thread to see it doesn't work:
          https://stackoverflow.com/questions/51420122/cannot-get-bat-file-to-run-after-installation-with-qt-installer

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bonnie
            wrote on last edited by Bonnie
            #5

            Yes, you cannot use addOperation in installationFinished, it is not meant to.
            But I think there's no need to do that.
            Operations added by addOperation after the default createOperations() are executed after the component contents are extracted to the target folder, so I consider it is run after the installation of the component.
            If you arrange your components well, you don't have to run it after the whole installation.
            But if you insist, I think you can try installer.performOperation(name, arguments) ("Execute" as the name).

            A 1 Reply Last reply
            0
            • B Bonnie

              Yes, you cannot use addOperation in installationFinished, it is not meant to.
              But I think there's no need to do that.
              Operations added by addOperation after the default createOperations() are executed after the component contents are extracted to the target folder, so I consider it is run after the installation of the component.
              If you arrange your components well, you don't have to run it after the whole installation.
              But if you insist, I think you can try installer.performOperation(name, arguments) ("Execute" as the name).

              A Offline
              A Offline
              akhi95
              wrote on last edited by
              #6

              @Bonnie Sorry for the late reply. Your line "Operations added by addOperation after the default createOperations() are executed after the component contents are extracted to the target folder, so I consider it is run after the installation of the component." helped me a lot. Your suggestion installer.performOperation(name, arguments) also didn't work outside createOperations(). So I did this: using addOperation, I saved the arguments in a text file and then I ran the batch file as I have shown in my question.

              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