我有一个Perl脚本,需要两个命令行参数,需要一段时间才能运行。我正在使用ActiveState Perl来运行它。我可以打电话给它
wperl script.pl arg1 arg2from a command prompt and it runs in the background fine. If I change the .pl association from perl.exe to wperl.exe and call it with
script.pl arg1 arg2the arguments don’t get passed. Is there something similar to the
#!/usr/bin/perl
like I can use to force wperl
to get used?
您可以做的是在任何资源管理器窗口的工具>文件夹选项>文件类型中更改与wperl.exe相关的文件关联,并通过高级>打开>编辑命令行更新.pl扩展名
{Path to wperl}\wperl.exe "%1" %*
这可确保在您使用脚本调用脚本时将所有命令行参数(%*)传递给wperl.exe
script.pl arg1 arg2
Perlmonks节点wperl.exe vs perl.exe建议将.wpl扩展名与wperl相关联。将要在wperl下运行的所有脚本命名为.wpl扩展名,其他.pl命名文件使用普通的perl.exe。
unless ($^X =~ m/wperl\.exe$/i) {
exec "wperl",$0,@ARGV;
exit 0;
}