1

Could someone try to help me out to run a Perl program from a PowerShell script? I'm trying to save the script results into a PowerShell variable.

So far, I have tried the below from the Powershell ISE. But it does not seem to be working.

perl 'C:\Program Files (x86)\ABC\ABC Software\bin\testcheck.pl -print verbose'

Powershell Script Path: C:\MyScripts
Perl Program Dir: C:\Program Files (x86)\ABC\ABC Software\perl\bin\perl.exe

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
user3834663
  • 513
  • 2
  • 7
  • 17
  • 1
    `perl 'C:\Pr...in\testcheck.pl -print verbose'` -> `perl 'C:\Pr...in\testcheck.pl' -print verbose`. If that doesn't help you need to provide more information. Did you add the path to the Perl executable in your PATH envirenment variable. Also, how *exactly* is it "not working"? – Ansgar Wiechers Jul 27 '19 at 14:35
  • Can I explicitly mention the Perl executable path in the script itself? – user3834663 Jul 27 '19 at 16:16
  • I'm getting the following message perl : The term 'perl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. – user3834663 Jul 27 '19 at 16:17
  • 2
    Re "*I'm getting the following message perl : The term 'perl' is not recognized as*", That means that `perl.exe` isn't in your path. You'll need to provide the full path to `perl.exe` (`& 'C:\Program Files (x86)\ABC\ABC Software\perl\bin\perl.exe' 'C:\Program Files (x86)\ABC\ABC Software\bin\testcheck.pl' -print verbose`) – ikegami Jul 27 '19 at 18:13
  • 2
    Re "*Can I explicitly mention the Perl executable path in the script itself?*", You could create a file association. Then, you'd simply treat the script as the program to run ( (`& 'C:\Program Files (x86)\ABC\ABC Software\bin\testcheck.pl' -print verbose`) – ikegami Jul 27 '19 at 18:14

0 Answers0