Powershell – Running bat file through powershell is not exiting in Jenkins

batchJenkinspowershell

We are using Linux Jenkins server for our deployment in a Windows machine. We added this machine as a node and running deployment on it. We are using powershell for our deployment, everything is working but
for a bat file that uses our application to start is not working properly.

This is our command we used in powershell.

write-host "Starting store"
cmd.exe /c c:\store\start.bat

Its starting the application in windows server but its not completing in Jenkins. Please note our application is a GUI application. See the status in Jenkins

Store Startup...
Real Path: C:\store\
PID File: engine.pid
Executables: store.exe,python.exe,pythonw.exe
PID Dir: C:\store\tmp\
------------------------
Starting Store...
------------------------

After this, its keep on this and further Jenkins step is not executing. But when we check in windows server we can see application is started successfully.

We also tried starting bat file in following ways:

start ""  /c 'c:\store\store.bat' 
Start-Process cmd.exe -Argument "/c c:\store\store.bat"

While using these options Jenkins coming to next steps and all Jenkins jobs are executing but in windows server application is not started.

Can anyone please help us on it.

Best Answer

Fixed it by changing the script as follows:

Start-Process c:\store\store.bat