in reply to Re: system() - output folder?
in thread system() - output folder?

my code runs like this:
my $executable = "C:/Desktop/file.exe"; my $output = "C:/Desktop/Folder"; system("$executable", "Argument") == 0 or die "system failed: $?";
The program 'file.exe' generates output files on its own, I just need to specify the folder so it outputs it there.

Replies are listed 'Best First'.
Re^3: system() - output folder?
by linuxer (Curate) on Jul 18, 2008 at 16:47 UTC

    you can chdir to $output before you do your system call.

    if you save your current workdir (Cwd - getcwd) before that chdir, you can chdir back to the previous workdir afterwards, if necessary.

    update: minor text changes, so it is (hopefully) more precise

      thx...it works great!