You normally end a batch file with a line that just says exit
. If you want to make sure the file has run and the DOS window closes after 2 seconds, you can add the lines:
timeout 2 >nul
exit
But the exit
command will not work if your batch file opens another window, because while ever the second window is open the old DOS window will also be displayed.
SOLUTION: For example there's a great little free program called BgInfo which will display all the info about your computer. Assuming it's in a directory called C:\BgInfo
, to run it from a batch file with the /popup
switch and to close the DOS window while it still runs, use:
start "" "C:\BgInfo\BgInfo.exe" /popup
exit