简体   繁体   English

从perl运行exe,并将多个参数作为变量

[英]Run exe from perl with several argument as variables

I'm trying to run an exe file in Perl on windows using the system command. 我正在尝试使用系统命令在Windows的Perl中运行一个exe文件。

The exe should get several arguments which are all variables. exe文件应该有几个都是变量的参数。 But it fails with the error "Can't spawn" (as well as some other errors) 但失败并显示错误“无法生成”(以及其他一些错误)

I tried several ways ( some don't make any sense ) 我尝试了几种方法(有些没有任何意义)

  system ($some_exe, “$PARAM1" “$PARAM2);
  system ($some_exe.“$PARAM1".“$PARAM2);
  @args = ($some_exe, “$PARAM1" “$PARAM2);      
  system(@args)

So how can I do that ? 那我该怎么办呢?

You can put multiple arguments with comma-separated (just an array). 您可以使用逗号分隔多个参数(只是一个数组)。

system($path, $arg1, $arg2, $arg3, ...);

See: perldoc 另请: perldoc

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

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