Executing Powershell from Perl

后端 未结 2 1106
清歌不尽
清歌不尽 2020-12-22 03:15

I have a bunch of Powershell scripts which I need to run from Perl. I have the following code but for some reason the Powershell scripts dont get invoked. I have tried both

相关标签:
2条回答
  • 2020-12-22 04:06

    You need to use -File instead of -Command

    0 讨论(0)
  • 2020-12-22 04:17

    Are you sure your code is formatted correctly? Shouldn't you be using quotes?

    system("$pwspath -command $path");
    

    Backtick should work, try:

    my @stdout = `$pwspath -command $path`;
    print join("\n", @stdout),"\n";
    
    0 讨论(0)
提交回复
热议问题