P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Batch files need a shell to execute them, so Windows will launch a new cmd to execute the batch file when you do system("$scriptDir/dosTest.bat");. Similarly, executing the shell script in linux will launch the shell listed in the #! line. The batch file or shell script is then executed by this shell. The batch file or shell script then proceeds to set the shells environment variables, which works. Then the shell exits and Perl continues to execute. Nowhere did you change Perl's environment. Nor is it possible to do so. At least not directly. The trick is to have the batch file or shell script tell your Perl script how to modify its environment, then have your Perl script obey the request.
I'm guessing you can't run modify the batch file. If so, you can use the following strategy instead:
In reply to Re: Issue with env variables set through dos batch
by ikegami
|
|