Solved Windows batch file closing down

June 8, 2012 at 01:11:52
Specs: Windows XP
I have a windows batch file which execute few steps. The file look like as below:

set ZP_DIR=lifepro114\114\src\custom

set /p Run_View=What is the name of the view? 

set SD=%Run_View%

set /p Run_pgm=What is the name of the program? 

set PG=%Run_pgm%



CALL compfj %PG% %SD%
if errorlevel 1 goto :fail

echo Compiled Successfully
goto :end

echo Compilation Failure
goto :end


My problem is it is closing down the command promt once the execution is completed. How to stop this.Please help.

See More: Windows batch file closing down

Report •

June 8, 2012 at 03:51:11
✔ Best Answer
After pause, use:
exit /B


Fri 06/08
 5:49:38=>exit /?
Quits the CMD.EXE program (command interpreter) or the current batch

EXIT [/B] [exitCode]

  /B          specifies to exit the current batch script instead of
              CMD.EXE.  If executed from outside a batch script, it
              will quit CMD.EXE

  exitCode    specifies a numeric number.  if /B is specified, sets
              ERRORLEVEL that number.  If quitting CMD.EXE, sets the process
              exit code with that number.

Fri 06/08

When your only tool is a hammer, every problem looks like a nail.

Report •

June 13, 2012 at 12:09:43
I thought that you have to use quotes after the set /p variable="", i suppose I am out of date though?

:: mike

Report •

June 13, 2012 at 13:27:04
That code worked for fine for me.

Maybe explain your issue a little more.


Report •

Related Solutions

Ask Question