Qt World Summit: Register Today!

How to add a step of compilation of a .bat file

  • I have my application done by qt. Now i want Qt start a .bat file each time i compile my project.
    However, i can't see my bat file is started. Can i have an option to be sure my .bat file is started each time of compilation?

  • @cdcc0606

    How do you intend to start the .bat file?

    You need to give some details. Otherwise it is really hard to guess what are you trying to do.

  • @cdcc0606 Hi,

    You can run a batch command before of after the link during compilation.
    Something like that :

    .pro file:

    QMAKE_PRE_LINK = CMD /c CALL "C:\path\to\my\batch.cmd"



    Compilation output:

    Pinging with 32 bytes of data:
    Reply from bytes=32 time<1ms TTL=128
    Reply from bytes=32 time<1ms TTL=128
    Reply from bytes=32 time<1ms TTL=128
    Reply from bytes=32 time<1ms TTL=128
    Ping statistics for
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms

  • @koahnig
    I start my .bat file by add a step in compilation.
    Here is the photo how i do it
    0_1538128975718_Compilation step.png
    So to make sure my .bat file is started, i add an Pause in my .bat file. So my compilation is never end. So now i'm sure i started my .bat file. But if i delete my Pause in my .bat file. I'm not sure my .bat file is started.
    Is there an option to add to show the terminal when the .bat file is started?

  • @cdcc0606

    Goto the buttom line of creator:
    Press the the upper/lower triangle button marked above and switch on number 4 (in English Compilation Output").
    This window is showing the output of your batch file. See also the post of @Gojir4 also refering to this output window.

    I have just tested and introduced a batch in same location as you have done. The output is done to the compile window. See also the options provided by @Gojir4 which performed eventually when previous commands are performed successfully.

  • @koahnig
    Thanks so much

Log in to reply