Keep Batch File Open to enter more commands
Typically the solution you will see to this question upon googling is to add “pause” to the end of your batch file.
This will keep the batch open, but it will not allow you to enter additional commands and after hitting a key will close the window immediately.
Alternatively, if you would like to keep the window open, such as creating a shortcut to a command line app, you can use cmd.exe /K.
G:\PathToMyCommandLineExeApp G: MyApp.exe /? cmd.exe /K cmd.exe
Place the above code snippet into batch file of your choosing, such as start menu folder, and upon launch it will not change into the directory and path where your command line app is located, execute it displaying it’s parameters (/? is app specific) and then run cmd.exe with \K option which allows the window to stay open per MSDN (see reference below).
Posted on July 15, 2012, in Programming & Development and tagged arguments, bat, batch, batch file, cmd, cmd prompt, cmd.exe, command, command line shortcut, command prompt, commands, don't close, keep open, ms, ms-dos, msdos, parameters, prompt. Bookmark the permalink. 1 Comment.
Pingback: Convert VDI to VMDK with VBoxManage « Fraction of the Blogosphere