Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

ENV PATH didn't take effect

by anaconda_wly (Scribe)
on Jun 07, 2013 at 05:19 UTC ( #1037577=perlquestion: print w/replies, xml ) Need Help??
anaconda_wly has asked for the wisdom of the Perl Monks concerning the following question:

Sorry it may be not proper to post the question here but I did get quick good answer here. . .I'm using Win2k3 32bit and log in as administrator. I checked computer->system properties->Environment variables->System variables->PATH has added the path(saying c:\abc) which I'm wanting. But when I click-opened a command prompt and type PATH, c:\abc is not there in PATH display and any commands under c:\abc not found. Only when run a command prompt as administrator, can I see it. Who can explain this to me? Doesn't System variables appended to all other user's ENV profiles? WHy I must always run cmd prompt as administrator?

Replies are listed 'Best First'.
Re: ENV PATH didn't take effect
by Happy-the-monk (Abbot) on Jun 07, 2013 at 06:03 UTC

    I am afraid I am not qualified for the windows support, but my best guess is, the system variables do not get propagated to all users as you suspect.

    I think, that should be the normal behavior.

    You can modify your own PATH variable in Perl through the %ENV hash.

    $ENV{PATH} contains the PATH, and you can modify it.

    Subsequent shells or cmd prompts invoked by your Perl script use that information.

    Cheers, Sören

    edit: strikethrough - wrong thought

    (hooked on the Perl Programming language)

      Thank you for the response. In fact, I changed the Path variable using Perl by TieRegistry. The system path do changed. But the click-opened command prompt didn't. If it didn't propagate to all users, I've already logged in as administrator, why I should right click opened "run as administrator" to see this change is beyond my understanding. I expect after I added the PATH env, all users can use it, no need to set it manually any more.

        The change, if made permanent, may take effect after a logoff/logon.

        The environment on disk is copied to your live environment on logon.

        Changing the config on disk does not followup in memory right away.

        Cheers, Sören

        (hooked on the Perl Programming language)

Re: ENV PATH didn't take effect
by Anonymous Monk on Jun 07, 2013 at 07:26 UTC

    You might be interested in CleanPath Cleans up the System and User-specific PATH persistent environment variables by removing duplicate and invalid entries. Can also add directories to the System PATH. Note that it has been wrapped by pl2bat for ease of use under Windows NT. This script does not work for Win9x. I've tested it under WinNT, Win2K, and WinXP.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1037577]
[Corion]: Discipulus: Windows isn't that complicated, at least if you look at it from the perspective of getting input via wndproc and answering to each message ;)
[Corion]: Of course, what you get put into your wndproc needs a lot of documentation ;))
Discipulus mmh maybe this is ovehelming my faculties

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2017-01-17 10:06 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (154 votes). Check out past polls.