Author Posts

January 3, 2018 at 4:09 pm

Hi,

I'm exploring the possibilities of Powershell and I'm wondering if it's possible to launch a perl script in Powershell.

Situation:
First, I need to move a couple of files from directory A to B.
Secondly I need to launch a Perl script. This script will perform some data processing on the files in directory B

The first part is not an issue. But I'm having issues with the second part.

The perl script is in folder C:\Customer\DirectoryB => name: parsing.pl

I'm trying with the script:

start-process perl parsing.pl

But this isn't working. I'm getting the error message "This command cannot be run due to the error: the system cannot find the file"

I already tried adding the directory C:\Customer\DirectoryB, but this isn't working.

Who can help me?

Thanks in advance for the help.

Best regards,
Hans

January 4, 2018 at 4:59 pm

Does it throw the same error if you put in the full path to perl.exe?

January 4, 2018 at 7:50 pm

You could try to change the current directory before launching perl like this:

Push-Location -Path 'C:\Customer\DirectoryB'
Start-Process -FilePath 'Full path to perl.exe' -ArgumentList 'C:\Customer\DirectoryB\parsing.pl'
Pop-Location