Executing Batch script


We have a batch script to perform certain deployments, and for sometime we want to keep using that script. I am extracting my package to a temp location and calling batch script. I am able to call the batch script, but my Octopus project is reporting that step is complete even though that batch script is taking some time to complete the execution. is there any other way to execute the batch script? or change its behavior?

If (Test-Path “D:\temp\CWSvcTest\Deploy.bat”){
Set-Location "D:\temp\CWSvcTest"
start-process “cmd.exe” “/c D:\temp\CWSvcTest\Deploy.bat”

Hi Manasa, thanks for reaching out.

You can use the -Wait parameter with Start-Process to wait for the command to finish before moving on.

https://stackoverflow.com/questions/1741490/how-to-tell-powershell-to-wait-for-each-command-to-end-before-starting-the-next has some more details on how to wait for a command to complete.

Matt C


That is exactly what i need. thank you for the help.