Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

simple batch file question

  • Please log in to reply




  • Member
  • PipPipPip
  • 305 posts
is there a command i can insert at the end of my batch files to keep them from closing the command window when it finishes. i need to be able to actually see the summery printout at the end but it keeps quiting on me the second it finishes

Edited by mikeloeven, 19 March 2010 - 11:25 PM.

  • 0




    Member 2k

  • Member
  • PipPipPipPipPip
  • 2,751 posts
There are at least a couple of different ways to do it.
  • One is to use "cmd /k name_of_batch_file" to launch your batch file. For example, let's say your batch file is named "test.bat" and it's in the root directory of drive C:. Click Start > Run, type in cmd /k c:\test.bat and press [Enter]. The "c:\test.bat" will run and leave the CMD window open. To close the CMD window, either click the "X" at the top right corner or type exit and press [Enter].

  • Another way to do it would be to add the following three lines to the end of your batch file:

    echo Press any key to exit ...
    pause > nul

    Your batch file will remain open until you either click the "X" at the top right corner or press [Any] key.

  • 0



    Je suis Napoléon!

  • Administrator
  • 26,018 posts
  • MVP
even easier than that...just put "pause" (without the quotes) at the end of the batch...it'll prompt you to press a key when it's finished
  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP