Trying to add environmentvariable to path: howto?

B

Bart

Hi,

I'm trying to extend the path variable by adding a path that points to
a user directory.
Obviously I don't want to hardcode that (C:\Users\Me\Bin), because it
should work for al users.

I want all users to have their own space to add their favorite
batchfiles etc, so they can be called from the commandline interface
(and from other batch-files).

On Linux this would be accomplished by adding :~/SomePath to the path
statement.

On Win7 I tried adding %USERPROFILE% and %HOMEDRIVE%%HOMEPATH%, both
to no avail, I end up with a path like:

C:\Users\Bart>path
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;
[...snip...]
C:\devel\fpc\bin\i386-Win32;C:\devel\fpc\bin\i386-Win32;%USERPROFILE%\bin

So the %USERPROFILE% does not expand here.
In the default path statement there are numerous occasions of use of
environentvariables, and also TEMP is defined using %USERPROFILE%.

Obviously I am doing something wrong here, so how do I should I do
that?

Bart
 
D

David H. Lipman

From: "Bart said:
Hi,

I'm trying to extend the path variable by adding a path that points to
a user directory.
Obviously I don't want to hardcode that (C:\Users\Me\Bin), because it
should work for al users.

I want all users to have their own space to add their favorite
batchfiles etc, so they can be called from the commandline interface
(and from other batch-files).

On Linux this would be accomplished by adding :~/SomePath to the path
statement.

On Win7 I tried adding %USERPROFILE% and %HOMEDRIVE%%HOMEPATH%, both
to no avail, I end up with a path like:

C:\Users\Bart>path
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;
[...snip...]
C:\devel\fpc\bin\i386-Win32;C:\devel\fpc\bin\i386-Win32;%USERPROFILE%\bin

So the %USERPROFILE% does not expand here.
In the default path statement there are numerous occasions of use of
environentvariables, and also TEMP is defined using %USERPROFILE%.

Obviously I am doing something wrong here, so how do I should I do
that?

Bart

A place for common batch files should be in a place that is common to all users such as...
C:\users\pulic\tools
C:\Documents and Settings\All Users\tools
c:\tools

You can't use USERPROFILE baecuse that is depentent on the User Login

Right-Click on "My Computer" --> Advanced --> Environmental variables
Under "System variables" find "path"
Choose "edit"

Append you string (w/o using other env. variables).
 
Z

Zaphod Beeblebrox

David H. Lipman said:
From: "Bart said:
Hi,

I'm trying to extend the path variable by adding a path that points
to
a user directory.
Obviously I don't want to hardcode that (C:\Users\Me\Bin), because
it
should work for al users.

I want all users to have their own space to add their favorite
batchfiles etc, so they can be called from the commandline
interface
(and from other batch-files).

On Linux this would be accomplished by adding :~/SomePath to the
path
statement.

On Win7 I tried adding %USERPROFILE% and %HOMEDRIVE%%HOMEPATH%,
both
to no avail, I end up with a path like:

C:\Users\Bart>path
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;
[...snip...]
C:\devel\fpc\bin\i386-Win32;C:\devel\fpc\bin\i386-Win32;%USERPROFILE%\bin

So the %USERPROFILE% does not expand here.
In the default path statement there are numerous occasions of use
of
environentvariables, and also TEMP is defined using %USERPROFILE%.

Obviously I am doing something wrong here, so how do I should I do
that?

Bart

A place for common batch files should be in a place that is common
to all users such as...
C:\users\pulic\tools
C:\Documents and Settings\All Users\tools
c:\tools

You can't use USERPROFILE baecuse that is depentent on the User
Login

Right-Click on "My Computer" --> Advanced --> Environmental
variables
Under "System variables" find "path"
Choose "edit"

Append you string (w/o using other env. variables).
Actually, don't add it to the System variables, it won't work there
because that path is applied without a user context so the
user-specific variable replacement doesn't apply. You have to add a
new PATH variable under User variables and add it there, and it will
get appended to the end of the PATH from the System variables. Not
sure if this will help your situation or not...

Another way to do it would be to use a logon script that alters the
PATH by including a line like PATH=%PATH%;%USERPROFILE%
 
B

Bart

Op Thu, 5 Jan 2012 11:35:05 -0500 schreef "Zaphod Beeblebrox"
Actually, don't add it to the System variables, it won't work there
because that path is applied without a user context so the
user-specific variable replacement doesn't apply. You have to add a
new PATH variable under User variables and add it there, and it will
get appended to the end of the PATH from the System variables. Not
sure if this will help your situation or not...

Not really sure what you mean by that.
Do I have to make a new User variable named PATH?
Another way to do it would be to use a logon script that alters the
PATH by including a line like PATH=%PATH%;%USERPROFILE%

And how would I do that?

(Excuse me for sounding stupid, but my current setup is 11 years old,
using WinMe/Suse 10.0, so my knowledge is ancient.
I could do this in a few minutes on Win9x.
The win7 is on a new laptop from my girlfriend.)

Bart
 
B

Bart

A place for common batch files should be in a place that is common to all users such as...
C:\users\pulic\tools
C:\Documents and Settings\All Users\tools
c:\tools

No, I do not look for a common placeholder, each user should have
their own space, so other users will not delet their preferred
collection of batch-files.

You can't use USERPROFILE baecuse that is depentent on the User Login

Which is exactly what I want.

Right-Click on "My Computer" --> Advanced --> Environmental variables
Under "System variables" find "path"
Choose "edit"

Append you string (w/o using other env. variables).

And this is how I did it (being logged in as administrator).

Bart
 
D

David H. Lipman

From: "Bart said:
No, I do not look for a common placeholder, each user should have
their own space, so other users will not delet their preferred
collection of batch-files.



Which is exactly what I want.



And this is how I did it (being logged in as administrator).

Bart

If it is not standardized and left up to each user then let each user deal with it.

As a network admin I say standardize it so you know how to support each and every user
because they are all the same.
 
Z

Zaphod Beeblebrox

Bart said:
Op Thu, 5 Jan 2012 11:35:05 -0500 schreef "Zaphod Beeblebrox"


Not really sure what you mean by that.
Do I have to make a new User variable named PATH?

Correct - which means doing so for every user on every PC, which is
why I offered that it may not help your situation.
And how would I do that?

By using the Group Policy Editor, which may not exist for you - Home
versions of Windows do not include it, and from your next comment it
seems likely that is what you are working with. I got the impression
this might be a multiple system arrangement possibly in a domain
environment, but that appears to not be the case. Probably best to
use the User variable approach.
(Excuse me for sounding stupid, but my current setup is 11 years
old,
using WinMe/Suse 10.0, so my knowledge is ancient.
I could do this in a few minutes on Win9x.
The win7 is on a new laptop from my girlfriend.)

No worries, we all have to start somewhere, and the curve can be steep
when coming from a different environment like Linux and the Win9x
series.

--
Zaphod

Arthur Dent, speaking to Trillian about Zaphod:
"So, two heads is what does it for a girl?"
"...Anything else he's got two of?"
 
B

Bart

Op Fri, 6 Jan 2012 08:16:10 -0500 schreef "Zaphod Beeblebrox"
Correct - which means doing so for every user on every PC, which is
why I offered that it may not help your situation.
Aaarrrggggg.
I'll have to do it that way then, currently 3 users (damin, me,
girlfriend), not likely to become more...
By using the Group Policy Editor, which may not exist for you - Home
versions of Windows do not include it

I have to pay extra money for something trivial as that???

The learningcurve form Windows -> Linuz was steep, but I can manage
such thingson WinMe/Linux rather easily.
Why do they insist on making simple stuff so difficult, sigh.

Thanks for the advice.
I'll give it a try and come back if I don't succeed.

Bart
 
B

Bart

Op Thu, 5 Jan 2012 19:11:18 -0500 schreef "David H. Lipman"
If it is not standardized and left up to each user then let each user deal with it.

I am trying to standadize it, for all users.
They can put any scripts/batch-files in %USERPROFILE%\Bin

AFAIK an indivdual user cannnot alter the path for his account??

Bart
 
Z

Zaphod Beeblebrox

Bart said:
Op Fri, 6 Jan 2012 08:16:10 -0500 schreef "Zaphod Beeblebrox"

Aaarrrggggg.
I'll have to do it that way then, currently 3 users (damin, me,
girlfriend), not likely to become more...

Trust me, I feel your pain. I do system imaging and deployment for
our company's products, and every time a per-user setting rears its
ugly head, I have to struggle to find a way to automate it...
I have to pay extra money for something trivial as that???

The learningcurve form Windows -> Linuz was steep, but I can manage
such thingson WinMe/Linux rather easily.
Why do they insist on making simple stuff so difficult, sigh.

It is all about differentiating the product line so that they can
charge differently for the home vs business side of the product line.
No, I don't agree with it, but like you I have no choice but to deal
with it the best I can.
Thanks for the advice.
I'll give it a try and come back if I don't succeed.

You are welcome, hopefully this helps. If not, it might be possible
to circumvent the lack of the Group Policy Editor and make use of
login scripts in your environment regardless of Microsoft's wishes.
Often there are registry settings behind the local and group policies,
so it may still be doable.
 
Z

Zaphod Beeblebrox

Bart said:
Op Thu, 5 Jan 2012 19:11:18 -0500 schreef "David H. Lipman"


I am trying to standadize it, for all users.
They can put any scripts/batch-files in %USERPROFILE%\Bin

AFAIK an indivdual user cannnot alter the path for his account??

They can change the PATH in their User environment, but not the System
environment (unless they are admin users of course).
 
D

David H. Lipman

From: "Bart said:
Op Thu, 5 Jan 2012 19:11:18 -0500 schreef "David H. Lipman"


I am trying to standadize it, for all users.
They can put any scripts/batch-files in %USERPROFILE%\Bin

AFAIK an indivdual user cannnot alter the path for his account??

If they use the same machine there is no reason why each need their own foler and that
folder to be in the PATH.

I again suggest using a fixed location common to all and that location be in the PATH.
 
Z

Zaphod Beeblebrox

David H. Lipman said:
If they use the same machine there is no reason why each need their
own foler and that folder to be in the PATH.

I again suggest using a fixed location common to all and that
location be in the PATH.

Seems like user scripts should be separated by user, as Bart is
attempting to do. Why would it be better for them to be in a shared
location, so that for example I could overwrite or modify a script and
thereby affect your environment?
 
D

David H. Lipman

From: "Zaphod Beeblebrox said:
Seems like user scripts should be separated by user, as Bart is attempting to do. Why
would it be better for them to be in a shared location, so that for example I could
overwrite or modify a script and thereby affect your environment?

More importantly...

What could be so proprietary that each user needs their own folder for scripts and have
that in the PATH ?

I don't see how each user's scripts should be separated by the user. From a management
and logistics POV it is much better to use one common location. Personally, I don't see
what a script even needs to bve in the PATH. One can easily lauch a script via a LNK file
or desktop shortcut. I do it all the time. All my scripts are in KiXtart and only the
kix executables and other EXE/DLL files are in the PATH and aren't even in their own
folder. They are in %WINDIR% which is already in the PATH.
 
B

Bart

Op Fri, 6 Jan 2012 13:33:37 -0500 schreef "David H. Lipman"
What could be so proprietary that each user needs their own folder for scripts and have
that in the PATH ?

Some build scripts for example?
I don't see how each user's scripts should be separated by the user.

Maybe it's a Linux concept?
I've grown accustomed to it.

Bart
 
D

David H. Lipman

From: "Bart said:
Op Fri, 6 Jan 2012 13:33:37 -0500 schreef "David H. Lipman"


Some build scripts for example?


Maybe it's a Linux concept?
I've grown accustomed to it.

LOL
Maybe.... Maybe.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top