简体   繁体   English

如何模拟一个没有文件的.BAT文件的打开?

[英]How to simulate opening of .BAT file without one?

I want to launch several Perl scripts one after another (although, technically in parallel here) automatically. 我想一个接一个地启动多个Perl脚本(尽管在这里技术上是并行的)。

It is easy to make a routine where the script makes a trivial .BAT file consisting only with the next Perl script, for example: 可以很容易地创建一个例程,使脚本生成仅包含下一个Perl脚本的琐碎的.BAT文件,例如:

write_file("Z.bat", "$myfile_nextnumber.pl\n");
system "start Z.bat";

and you get nice output from each script in a separate window. 您会在单独的窗口中从每个脚本获得不错的输出。

But how to achieve this without creating any file? 但是如何在不创建任何文件的情况下实现这一目标?

The closest what I got: 我得到的最接近的:

system "start cmd /k $myfile_nextnumber.pl";

but in this case, it does not show the path and file that was executed. 但是在这种情况下,它不会显示已执行的路径和文件。

Why not just put a print statement before each system call? 为什么不只在每个系统调用之前放置print语句?

foreach my $file (@filelist) {
  print "Calling $file\n";
  system "start cmd /k $file";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM