Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

ENV Path didn't take effect

by anaconda_wly (Scribe)
on Apr 03, 2013 at 10:31 UTC ( [id://1026818]=perlquestion: print w/replies, xml ) Need Help??

anaconda_wly has asked for the wisdom of the Perl Monks concerning the following question:

print "$ENV{PATH} "."\n"; my $install_path = "c:\\bin"; if( !($ENV{PATH} =~ /c:\\bin/i) ) { print "1 "."\n"; $ENV{PATH} .= ";$install_path"; print "$ENV{PATH} "."\n"; }

print shows the path already been added. But when I check by opening a new session type path command or open registry:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment The path is still the old one. Anyone know why? Need save $ENV{PATH}?

Replies are listed 'Best First'.
Re: ENV Path didn't take effect
by BrowserUk (Patriarch) on Apr 03, 2013 at 10:38 UTC

    Modifying %ENV only affects the current process and any child processes it happens to start.

    It does not affect its parent; nor other non-child processes started afterwards.

    And it definitely does not change the registry.

    If you want to change the registry; use a module designed to do that. (Hint: search CPAN for the word "registry")


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: ENV Path didn't take effect
by marto (Cardinal) on Apr 03, 2013 at 10:40 UTC

    The change is only made to the current and child processes. To add something permanently take the advice given the last time you asked, which includes links explaining how this works.

    Update: Fixed typo

Re: ENV Path didn't take effect
by Anonymous Monk on Apr 03, 2013 at 10:49 UTC
Re: ENV Path didn't take effect
by vinoth.ree (Monsignor) on Apr 03, 2013 at 11:02 UTC

      Good luck getting that module.

Re: ENV Path didn't take effect
by sundialsvc4 (Abbot) on Apr 03, 2013 at 12:55 UTC

    Hey, this is just one way that Windows doesn’t do things quite the way that Unix does.   Redmond uses the registry for everything (when that concept does not formally exist in Linux), and it doesn’t use environment variables in exactly the same way.

      Hey, this is just one way that Windows doesn’t do things quite the way that Unix does. Redmond uses the registry for everything (when that concept does not formally exist in Linux), and it doesn’t use environment variables in exactly the same way.

      In what way is that an answer to the question? Something accurate?

        Thanks for all reply!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1026818]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-19 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found