graysky Posted December 29, 2004 Posted December 29, 2004 Is there a way to automate the addition of an entry to my path statement found under:Right-click "My Computer">Properties>Advanced>Environment VariablesUnder 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!
digitalfrost Posted December 29, 2004 Posted December 29, 2004 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?
graysky Posted December 29, 2004 Author Posted December 29, 2004 Thanks for the info... maybe someone knows the answer to your question..?
Alanoll Posted December 29, 2004 Posted December 29, 2004 SET PATH=%PATH%;NewEntryIs how you would append it in a batch script. Then use the REG command, and use the new PATH variable as the data to be imported.
graysky Posted January 2, 2005 Author Posted January 2, 2005 So I should be able to do this in my batch_file.cmd:SET PATH=%PATH%;c:\gnupgAnd 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!
Alanoll Posted January 2, 2005 Posted January 2, 2005 So I should be able to do this in my batch_file.cmd:SET PATH=%PATH%;c:\gnupgAnd 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.
graysky Posted April 9, 2005 Author Posted April 9, 2005 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.<{POST_SNAPBACK}>How would I go about adding the ENVIRONMENT registry entries via batch file without over-writing the current lines as digitalfront points out?
Gogol Posted April 9, 2005 Posted April 9, 2005 You should try pathman.exe from MS Resource KitThis tool exist in different version.Here is the Win2k ...Pathman.exe
seapagan Posted April 9, 2005 Posted April 9, 2005 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
graysky Posted April 9, 2005 Author Posted April 9, 2005 Actually, I just need a way to do this via commandline/batch file if that's able to do it
seapagan Posted April 9, 2005 Posted April 9, 2005 Actually, I just need a way to do this via commandline/batch file if that's able to do it<{POST_SNAPBACK}>Then, like gogol says, 'pathman' is the tool for you. Current link is HereThis 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 installSP
graysky Posted April 10, 2005 Author Posted April 10, 2005 Using pathman.exe was the perfect solution to my problem under WinXP... now, how can I do this under Win98?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now