Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Issue with env variables set through dos batch

by akrrs7 (Acolyte)
on Oct 13, 2011 at 15:50 UTC ( #931288=note: print w/ replies, xml ) Need Help??


in reply to Re: Issue with env variables set through dos batch
in thread Issue with env variables set through dos batch

The batch script run by itself from the cmd line works fine and sets the environment variables as expected. Even from within the Perl script - the set statements in the batch script output the said environment variables. The issue is not with the batch script. I am wondering why the last two print statements in the Perl script give me the error they do - or how do I make the environment variables stay put in the cmd window ? It seems that once the batch script is run (from within the perl script) - it wipes out the environment variables that are set and are not even recognized from within the same perl script...if that is the case how can I use those environment variables in the perl script ?


Comment on Re^2: Issue with env variables set through dos batch
Re^3: Issue with env variables set through dos batch
by Marshall (Prior) on Oct 13, 2011 at 16:11 UTC
    If you start a script, it gets the environment at the time. If that script fiddles with an environment variable, that is only a temporary setting for the duration that that script is running.

    If you set an environment variable before a script is started, then the script inherits that value when it runs. Back up another level, when Windows boots, certain values are set in the environment and all processes inherit those values.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://931288]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-12-26 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls