Launching a perl script in Powershell

This topic contains 2 replies, has 3 voices, and was last updated by  Olaf Soyk 2 weeks, 3 days ago.

  • Author
    Posts
  • #90685

    Hans
    Participant

    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

  • #90800

    Bill Kindle
    Participant

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

    • #90812

      Olaf Soyk
      Participant

      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

You must be logged in to reply to this topic.