Append to PATH using REG file?

D

Derek

Is there a way to add a folder to my PATH environment
variable using a REG file (or something like it)? Sadly
the following replaces PATH instead of appending to it:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Environment]
"PATH"="D:\\Blah"

Suggestions appreciated.
 
D

Derek

I have a bunch of programs and utilities that don't have
installers; they are just binaries that can be run from
anywhere. I'd like to add them to my path. Of course I
can do it by hand, but it would be cool just to click on
a reg file and have them all added at once. What can I
say, I'm lazy.
 
Y

Yves Leclerc

Maybe he is writing his own software and needs to add the PATH to the
environment as part of the install process??


"David Candy" <.> wrote in message
why
 
D

David Candy

You can't do what you want without writing a program.
Programs and documents can be added to the registry so typing their name without their path in the Start - Run dialog box or shortcut enables Windows to find them.

This is a generic reg file. Copy the lines below to a new Text Document and save it as anyname.reg. Edit it with your programs or documents.


In paths use \\ to seperate folder names in key paths as regedit uses a single \ to seperate it's key names. All reg files start with REGEDIT4. A semicolon turns a line into a comment. The @ symbol means to assign the value to the key rather than a named value.

The file doesn't have to exist. This can be used to set Word.exe to open Winword.exe.

This sample add IE.Txt (from IE5) to the registry so typing IE.Txt will open it. I think the file is called IE4.txt in IE4.

REGEDIT4
;The bolded name below is the name of the document or program, <filename>.<file extension>

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\IE.txt]

;The @ means the path to the file is assigned to the default value for the key.
;The whole path in enclosed in a quotation mark ".

@="\"C:\\Program Files\\Internet Explorer\\IE.txt\""

;Optional Parameters. The semicolon means don't process the line. Remove it if you want to put it in the registry

;Informs the shell that the program accepts URLs.

;"useURL"="1"

;Sets the path that is appended to the system path for that program

;"Path"="C:\\Program Files\\Microsoft Office\\Office\\"
To remove a program or document use RegDelete from the Help Page. For the above example type the following into RegDelete (note the trailing backslash)

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\format.txt\
 
D

David Candy

He wasn't. And a programmer wouldn't have bothered asking. They'd just do it.

--
----------------------------------------------------------
http://www.uscricket.com
Yves Leclerc said:
Maybe he is writing his own software and needs to add the PATH to the
environment as part of the install process??


"David Candy" <.> wrote in message
why



--
----------------------------------------------------------
http://www.uscricket.com
Derek said:
Is there a way to add a folder to my PATH environment
variable using a REG file (or something like it)? Sadly
the following replaces PATH instead of appending to it:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Environment]
"PATH"="D:\\Blah"

Suggestions appreciated.
 
J

James A. Smith

There is no need to do this from a reg file at all.

1.. From the desktop right click My Computer and click properties.
2.. In the System Properties window click on the Advanced tab.
3.. In the Advanced section click the Environment Variables button.
4.. Finally, in the Environment Variables window highlight the path
variable in the Systems Variable section and click edit. Add or modify the
path lines with the paths you wish the computer to access. Each different
directory is separated with a semicolon.
 
T

Torgeir Bakken \(MVP\)

Derek said:
Is there a way to add a folder to my PATH environment
variable using a REG file (or something like it)? Sadly
the following replaces PATH instead of appending to it:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Environment]
"PATH"="D:\\Blah"

Suggestions appreciated.
Hi

Using a registry file for this is not a viable solution.

When adding or removing components from the path, I suggest using
Pathman.exe (Path Manager).

Pathman.exe can be downloaded from here:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/pathman-o.asp

It will e.g. handle repeated entries.

Pathman.exe is also in the Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/...69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en

(The kit will install on WinXP or later, and you can copy needed files
out from it as you see fit, and most of the tools will work for Win2k
as well)


For a pure scripted solution, here is an example:

http://groups.google.com/[email protected]
 
T

Torgeir Bakken \(MVP\)

David said:
You can't do what you want without writing a program.
Programs and documents can be added to the registry so typing their name without their path in the Start - Run dialog box or shortcut enables Windows to find them.

and if you want to access "App Paths" entries from the command prompt,
use the START command.

This is a generic reg file. Copy the lines below to a new Text Document and save it as anyname.reg. Edit it with your programs or documents.


In paths use \\ to seperate folder names in key paths as regedit uses a single \ to seperate it's key names. All reg files start with REGEDIT4. A semicolon turns a line into a comment. The @ symbol means to assign the value to the key rather than a named value.

The file doesn't have to exist. This can be used to set Word.exe to open Winword.exe.

This sample add IE.Txt (from IE5) to the registry so typing IE.Txt will open it. I think the file is called IE4.txt in IE4.

REGEDIT4
;The bolded name below is the name of the document or program, <filename>.<file extension>

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\IE.txt]

;The @ means the path to the file is assigned to the default value for the key.
;The whole path in enclosed in a quotation mark ".

@="\"C:\\Program Files\\Internet Explorer\\IE.txt\""

;Optional Parameters. The semicolon means don't process the line. Remove it if you want to put it in the registry

;Informs the shell that the program accepts URLs.

;"useURL"="1"

;Sets the path that is appended to the system path for that program

;"Path"="C:\\Program Files\\Microsoft Office\\Office\\"
To remove a program or document use RegDelete from the Help Page. For the above example type the following into RegDelete (note the trailing backslash)

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\format.txt\
 
S

Sharon F

Is there a way to add a folder to my PATH environment
variable using a REG file (or something like it)? Sadly
the following replaces PATH instead of appending to it:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Environment]
"PATH"="D:\\Blah"

Suggestions appreciated.

System Properties> Advanced> Environment Variables (button). Add additions
using this screen.
 
D

Derek

Pathman looks handy -- and so do lots of the utilities in the
2003 Resource Kit Tools. Thanks for the link.
Derek said:
Is there a way to add a folder to my PATH environment
variable using a REG file (or something like it)? Sadly
the following replaces PATH instead of appending to it:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Environment]
"PATH"="D:\\Blah"

Suggestions appreciated.

Hi

Using a registry file for this is not a viable solution.

When adding or removing components from the path, I suggest using
Pathman.exe (Path Manager).

Pathman.exe can be downloaded from here:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/pathman-o.asp


It will e.g. handle repeated entries.

Pathman.exe is also in the Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/...69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en


(The kit will install on WinXP or later, and you can copy needed files
out from it as you see fit, and most of the tools will work for Win2k
as well)


For a pure scripted solution, here is an example:

http://groups.google.com/[email protected]
 
E

Eric McG

Try this as an alternative:

At a Command Prompt enter:

path=%path%;d:\blah

Enter "path" to verify the appended folder.

The Path should revert back to the default after restarting.

A simple batch file could be used in the Startup folder if need be.

This still works in Win2K Pro..don't have WinXP to verify.
 
E

Eric McG

Sorry, please ignore my suggestion.

The addition to the path disappears after closing the command prompt window.
 
A

Alex Nichol

Torgeir said:
Using a registry file for this is not a viable solution.

When adding or removing components from the path, I suggest using
Pathman.exe (Path Manager).

It may well be better though to follow the usual XP method of install,
where a custom path is put in registry for the program, so that searches
on behalf of other software do not grind down an enormous path.

That can be done with a simple reg file; this is for conf.exe
(netmeeting) and all that would be needed is to edit for the path and
file name of the program concerned (Note that [HKEY through CONF.EXE}
is a single line that will probably break at the space in App Paths


REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\CONF.EXE]
@="C:\\Program Files\\NetMeeting\\conf.exe"
"Path"="C:\\Program Files\\NetMeeting;"
 

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

Similar Threads


Top