Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pause the console window in .pl and .bat file?

As I know, when I run cs myConsoleApp.cs from windows command line, I can pause the Console Window by add the code below:

Console.ReadLine();

Then How can I pause Console Window in myConsoleApp.pl and myConsoleApp.bat? I just want to monitor the running result from the Console window. Thank you.

Suppose myConsoleApp.bat like this:

taskkill /f /im "E1.exe"
taskkill /f /im "E2.exe"

pause 

Suppose myConsoleApp.pl like this:

use strict;
use warnings;

print "Hello World!";

<>;
like image 883
Nano HE Avatar asked Mar 25 '10 07:03

Nano HE


2 Answers

pause for .bat

and

<>; #Read from STDIN

for Perl

like image 128
Alexandr Ciornii Avatar answered Oct 19 '22 23:10

Alexandr Ciornii


I don't know about in perl, but in a batch file it's easy:

pause

The help for this command states:

Suspends processing of a batch program and displays the message
Press any key to continue . . .

like image 41
Jon Skeet Avatar answered Oct 20 '22 00:10

Jon Skeet