Keep CMD open after BAT file executes
Put pause
at the end of your .BAT file.
When the .bat file is started not from within the command line (e.g. double-clicking).
echo The echoed text
@pause
echo The echoed text
pause
echo The echoed text
cmd /k
echo The echoed text & pause
Depending on how you are running the command, you can put /k
after cmd
to keep the window open.
cmd /k my_script.bat
Simply adding cmd /k
to the end of your batch file will work too. Credit to Luigi D'Amico who posted about this in the comments below.
Just add @pause
at the end.
Example:
@echo off
ipconfig
@pause
Or you can also use:
cmd /k ipconfig