How can I open a Windows CMD window for Perl and r

2019-07-24 19:38发布

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 run script.

标签: perl cmd window
1条回答
可以哭但决不认输i
2楼-- · 2019-07-24 20:06

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.

查看更多
登录 后发表回答