views:

38

answers:

3

when i run a .BAT file, it displays a message but immediately closes the window

how i can i force it to keep the window open so that i can see the message reeturned?

+3  A: 

One way is to conclude the batch file with the

PAUSE

command.

Philip Kelley
+1  A: 

You can also wrap it another batch file that calls the original and then pauses:

FOO.BAT
PAUSE

This also works for read-only batch files and compiled executables.

David X
A: 

An alternative is to execute this bat file from an already opened command prompt (shortcut: Windows Key + R, type cmd, press ENTER)

Gui13