Ned Cunningham wrote:
> HI all.
>
> Can anybody tell me how to execute a command "remotely" in a Perl
> script from a different directory.
> Please keep in mind I am asking what I want, not what you think I
> meant to say.
>
> I need to:
>
> ('cd /d e:\ned\nedsdir`);
> (`runprogram.exe -option - option -option`);
>
> The program needs to be run from its current location, but the path
> needs to be at the new directory?
>
> With the above code the directory is changed and the program run,
> however, the programs path is not set to the newly changed directory.
Either do something like this:
use Cwd;
$savecwd = $cwd;
chdir('e:\ned\nedsdir'); # perl function chdir()
$output = `runprogram.exe ...`;
chdir($savecwd);
or this (requires a fairly new cmd.exe):
$output = `cd /d e:\\ned\\nedsdir & runprogram.exe ...`;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>