Windows – Leave cmd windows open (called from batch script)

batch filecommand linewindows

I am launching 4 executables from a batch script:

@echo off
start ../../../../LD_Server.exe 12321 23432 11221 3
start LD_Client.exe 12321 pero
start LD_Client.exe 23432 tina
start LD_Client.exe 11221 sanja

This opens 4 cmd windows but after they do their work they all close. I want them to stay opened so I can read the output. How?

Best Answer

@echo off
start %COMSPEC% /k ../../../../LD_Server.exe 12321 23432 11221 3
start %COMSPEC% /k LD_Client.exe 12321 pero
start %COMSPEC% /k LD_Client.exe 23432 tina
start %COMSPEC% /k LD_Client.exe 11221 sanja

%COMSPEC% is an environment variable that points to your system's command interpreter (on Windows NT, C:\Windows\System32\cmd.exe), and the /k switch prevents the specified command's window from closing after execution.

Related Question