Jump to content

adding an entry to my path statement


Recommended Posts

Is there a way to automate the addition of an entry to my path statement found under:

Right-click "My Computer">Properties>Advanced>Environment Variables

Under system variables is a "Path" entry. I'd like to add a dir to that and have it present on my unattended, out-of-the-box install... anyone?

THANKS!

Link to comment
Share on other sites


Path is saved in HKLM,SYSTEM\CurrentControlSet\Control\Session Manager\Environment.

There is just one problem: You want to add something to the path, when you set path to a new value you would remove the entries that it's already set to. You have to look what the path is during setup and incorporate these folders in your .reg/.inf file.

Or is there a way to add something to a registry value without replacing it?

Link to comment
Share on other sites

So I should be able to do this in my batch_file.cmd:

SET PATH=%PATH%;c:\gnupg

And that should append the path to my current entry. Is that correct? I'm not clear on what to do with the REG command as you stated.

Thanks!

Link to comment
Share on other sites

So I should be able to do this in my batch_file.cmd:
SET PATH=%PATH%;c:\gnupg

And that should append the path to my current entry. Is that correct? I'm not clear on what to do with the REG command as you stated.

Thanks!

that will set it for THAT CMD INSTANCE ALONE. If that's what you want, then fine.

If you want it for others, you could simply add that line to all your CMD files, or add it to the ENVIRONMENT registry entries. The copy paste to each CMD file is by far simpler.

Link to comment
Share on other sites

  • 3 months later...
that will set it for THAT CMD INSTANCE ALONE. If that's what you want, then fine.

If you want it for others, you could simply add that line to all your CMD files, or add it to the ENVIRONMENT registry entries. The copy paste to each CMD file is by far simpler.

How would I go about adding the ENVIRONMENT registry entries via batch file without over-writing the current lines as digitalfront points out?

Link to comment
Share on other sites

If you want to add a path to your unnatended XP install CD, this is what I do :

Be aware that this will edit the registry files for your installation - test it in Virtual pc or similar first!

You have to edit the file 'HIVESYS.INF' which is located in your \i386 folder. Search for the following keys in this (ascii text) file :

HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"

There is a variable here called "Path" that contains the default system path, simply add your own to the end, remembering to precede it with a semicolon ( ; ) as below :

"Path",0x00020002,"...<data cut for brevity>;%SystemRoot%\System32\Wbem;c:\gnupg"

Dont change any of the values already there, just add yours to the end.

I do this always to add the path to my collected command-line tools, to avoid cluttering up the system32 folder.

EDIT:

To make it better compatible, I suppose you could replace the 'C:' in your path with '%systemdrive%' instead, making it like ';%systemdrive%\gnupg'. This will be replaced by the letter of the drive containing windows.

Hope that helps,

SP

Link to comment
Share on other sites

Actually, I just need a way to do this via commandline/batch file if that's able to do it

Then, like gogol says, 'pathman' is the tool for you. Current link is Here

This works on XP even though it is in the 2K resource kit. Check the documentation or use 'pathman /?' to get usage info. Note that this program is installed by default into the 'C:\Program Files\Resource Kit' directory, move it somewhere in the path to get easier usage from batch files.

My previous reply was based on your first post :

and have it present on my unattended, out-of-the-box install

SP

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...