Nominate our 2022 Qt Champions!

QtCreator Custom Process Step Powershell

  • I am trying to add a custom process step to my project. I am trying to execute a powershell script.

    Command: Powershell
    Arguments: -File Script.ps1
    Working directory: %{sourceDir}

    This works fine, but the powershell script never exits.

    Write-Host "Test"

    Even with this simple script, it will print Test and then just sits there. The build process will not complete after this.

    The only way I can get this to work is to kill the process using the following command in the powershell file

    Get-Process Powershell | Stop-Process

    This returns -1 however, so I have to wrap this in a batch file with EXIT /B. With all this in place it does seem to work, but it seems a little hacky for running a simple script. Does anyone have any ideas or suggestions about this?

  • Hi,

    try to pass -ExecutionPolicy Unrestricted as parameter.

Log in to reply