如何打开一个Windows CMD窗口的Perl和运行命令? [英] How can I open a Windows CMD window for Perl and run a command?
本文介绍了如何打开一个Windows CMD窗口的Perl和运行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法我可以打开一个新的cmd窗口和传递一个变量,一旦完成关闭该窗口?
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.
推荐答案
主要脚本:
my ($x, $y) = (888, 999);
system('start', 'List Perl files', 'perl', 'other_script.pl', $x, $y);
另一个脚本:
print "Args received = @ARGV\n";
<STDIN>;
BTW,可能有更好的方法来实现更大的目标 - 例如,组织所需的功能成模块。通过命令行参数和 @ARGV
将信息从一个脚本传递到另一个脚本可能是一个麻烦和限制因素。
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.
这篇关于如何打开一个Windows CMD窗口的Perl和运行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文