Console Applications start as a background process with no visible window

Hi,

We are deploying some console applications and after the deploy we would like to see the console output of the running applications. We are running the executables with the following powershell command as a deployment step:

$excutableTaskFolder = $OctopusParameters[‘Octopus.Action[Deployment].Output.Package.InstallationDirectoryPath’]
$fullPath = ("{0}/{1}_{2}.{3}" -f $excutableTaskFolder,“Job”, $JobType, “exe”)
Start-Process $fullPath

The problem is that the executable always starts as background process and we can’t see the console windows of the process. We always have to kill the process and start it again from the machine manually (This time console window appears as normal).

What can be the problem or how can we start the executable as an app (with visible console window) instead of background process.

Regards,
Daghan

Hi Daghan,

Thanks for getting in touch! I believe you can do this by using the Start-Process cmdlet with the -NoNewWindow flag in PowerShell. It will stop PowerShell from creating a new window in the background to run the command in, keeping everything in the original window.

(Copy from the Microsoft website)

-NoNewWindow

Start the new process in the current console window. By default Windows PowerShell opens a new window.

You cannot use the NoNewWindow and WindowStyle parameters in the same command.

Let me know if this helps. :slight_smile:

Best regards,
Daniel

Hi Daniel,

This actually made the console logs span on the Octopus task log instead of opening a new console window (starting the exe with console window).

What I would like to see a new console window for the executable as I double-clicked the exe or running the powershell script from the machine.

Thanks,
Daghan

Hi Daghan,

Thanks for getting back! I think I misinterpreted your first question a bit sorry. I should mention that the Octopus server runs as a service, due to this, you can not have anything that requires a window or interaction to run.
Everything is handled as an automated process.

Sorry if I caused any confusion, I hope this clears things up a bit.

Best regards,
Daniel