开发者

How to open a command prompt with Perl?

开发者 https://www.devze.com 2023-01-11 02:09 出处:网络
Ok, read that again. I need to open a windows prompt WITH perl. This is because I want multiple prompts running perl scripts in parallel, but don\'t want to open them all by 开发者_如何学运维hand. So

Ok, read that again. I need to open a windows prompt WITH perl. This is because I want multiple prompts running perl scripts in parallel, but don't want to open them all by 开发者_如何学运维hand. So I want a script that I can call (host), tell the number of command prompts to open (clients), path to the client script to run, and even put in inputs if the clients ask. So, two major things:

  1. How to open a prompt with a perl script

  2. How to pass input to that prompt

Thanks! (P.S. I know that it would be a huge mistake to run a host script that calls the same host script, hopefully my boss doesn't do that :P)


This might not be a Perl question, so to speak, but a Windows question. I suspect what you want to do is call "start <options> <script>".

For example:

my $cmd = "perl -w otherscript.pl";
my $result = system( "start /LOW $cmd" );

This should start the desired command in a new window and return immediately. Type start /? for other options which can change the new script's priority, hide the next window, or run in the current window.


This is a DOS/Windows question, not a Perl one.

Use

system("start cmd.exe /k $cmd")

See start /? and cmd /?.

0

精彩评论

暂无评论...
验证码 换一张
取 消