|
Posted by smallpond on June 3, 2008, 4:38 pm
Please log in for more thread options
Meal wrote:
> Hi Perl expert,
> I’m writing a simple script for a building system on windows vista.
> This script will run a .cmd file which sets a lot of environmental
> variables. After this, the script need to run a build command.
> The build command depends on these environmental variables.
> If I run the .cmd file with system or exec and then run the build
> command, the build command will not run within the correct
> environment. The system or exec simply start a new process and set the
> environmental variables there.
> My current solution is as below.
> exec(".\myenv.cmd&build -cC -amd64");
> It works since there's an "&", but I doubt in the future I need to
> add more complex commands. Absolutely I cannot concatenate each of
> them with an '&'.
> What's the correct solution for this issue?
> Thanks.
> Meal.
Why not set the environment variables within perl?
$ENV = 'C:\BDIR';
perldoc perlvar
The hash %ENV contains your current environment. Setting a value in "ENV"
changes the environment for any child processes you subsequently fork() off.
** Posted from http://www.teranews.com **
|