Wednesday, June 15, 2011

Keep CMD Open

Problem

The cmd window close after finish the execution of a bat file. The desired behavior is that the cmd stay opened to the input of new comands.

Reason

It is the default behavior.

Solution

  • Create a bat file that will call another bat. Ex: keppCmdOpen.bat
  • In the file put the line: start "" fileWithCommands.bat /k
  • Create the file fileWithCommands.bat and add the desired commands.

Others

If the need is just to see the window, and not to input commands, there is no need to two bats. Just put the pause command at the end of the file.

More info:

http://answers.yahoo.com/question/index?qid=20090306121738AAkg8Ij
http://pt.w3support.net/index.php?db=so&id=905352

No comments:

Post a Comment