开发者

How can I open a Windows CMD window for Perl and run a command?

开发者 https://www.devze.com 2023-01-17 15:53 出处:网络
Is there a way I can open a new cmd window and pass a variable and once completed close that window? I have found some info but not enough that I can get it to work.

Is there a way I can open a new cmd window and pass a variable and once completed close that window?

I have found some info but not enough that I can get it to work.

system('start "List Perl files" dir c:/dfd/dfdf.pl /B');

Opens window but does not开发者_如何学C run script.


Main script:

my ($x, $y) = (888, 999);
system('start', 'List Perl files', 'perl', 'other_script.pl', $x, $y);

The other script:

print "Args received = @ARGV\n";
<STDIN>;

BTW, there's probably a better way to achieve your larger goals -- for example, organizing the needed functionality into modules. Passing information from one script to another via command-line arguments and @ARGV can be a hassle and a limiting factor.

0

精彩评论

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