[英]if you have a perl script ready (in windows), what's the best way to run it from command line 100 times say and collect the data it produces?
I have written a perl script in Windows, which produces a line or two of output. 我已经在Windows中编写了一个perl脚本,该脚本会产生一两行输出。
I'd like to be able to run the script n=100 times over, say, from the command line without doing more coding in the script (unless there's an easy way to do that) and collect the output? 我希望能够从命令行运行脚本n = 100次,而无需在脚本中进行更多编码(除非有简单的方法可以执行此操作)并收集输出? I've been suggested a batch file might be in order?
有人建议我可能要按顺序处理批处理文件?
Basically, is there an easy way to: 基本上,有一种简单的方法可以:
[perl script.pl >> output + [Enter Key]] # n times in cmd
Thanks! 谢谢!
您可以在批处理文件中使用FOR循环:
for /L %%N IN (1, 1, 100) DO perl script.pl >> output.txt
Just wrap a for loop around your code: 只需在代码周围包裹一个for循环即可:
#!/your/perl
for ( my $i = 0; $i < 100; $i++ ) {
# YOUR ORIGINAL PERL CODE HERE
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.