in reply to Re: Using System command
in thread Using System command

Hello 9mohit2,

If you want to run two system commands like this, you either need to run them separately:

system('cd C:\\ABC\\'); system('pdftotext -layout R1.pdf');

or else combine them using a syntax recognised by the command prompt. For example, this works for me on Windows:

perl -wE "system('cd .. & dir');" # Note: ^

But there’s no need to use system to change the current working directory; use Perl’s built-in chdir function.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^3: Using System command
by choroba (Cardinal) on Oct 04, 2016 at 08:24 UTC
    > run them separately

    Would it help in this case? The cd in the first system wouldn't change the current directory for the script, only for the fork, so the next system would run in the previous directory. Or is cd global on Windows?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,