What's the registry key to alter the PATH environment in an MS-DOS prompt

  • Thread starter Thread starter Andrew Falanga
  • Start date Start date
A

Andrew Falanga

Hi,

I am having very little success in finding the registry key to alter
then contents of the PATH variable in an MS-DOS prompt (terminal)
session. Can anyone here tell me?

Andy
 
Andrew said:
Hi,

I am having very little success in finding the registry key to alter
then contents of the PATH variable in an MS-DOS prompt (terminal)
session. Can anyone here tell me?

Instead of altering the registry, you can use the UI. Right click on My
Computer and select Properties. This will bring up your System
Properties. Go to the Advanced tab and click the Environment Variables
button. There you can modify all environment variables, including PATH.

In the registry, there are two different keys depending on whether you
want the portion of the path that applies to all users (the machine
version) or to a specific user. The two locations are:

HKCU\Environment
HKLM\System\CurrentControlSet\Control\Session Manager\Environment
 
Instead of altering the registry, you can use the UI. Right click on My
Computer and select Properties. This will bring up your System
Properties. Go to the Advanced tab and click the Environment Variables
button. There you can modify all environment variables, including PATH.

In the registry, there are two different keys depending on whether you
want the portion of the path that applies to all users (the machine
version) or to a specific user. The two locations are:

HKCU\Environment
HKLM\System\CurrentControlSet\Control\Session Manager\Environment

Thank you. I was obviously unaware that this could be modified
through the method you describe. I was looking through the Control
Panel.

Andy
 
Andrew Falanga said:
Thank you. I was obviously unaware that this could be modified
through the method you describe. I was looking through the Control
Panel.

Andy
Hi Andrew,
You were not completely off because the environment variables are
accessible through the System applet in the Control Panel under "Advanced".
 
Andrew said:
Hi,

I am having very little success in finding the registry key to alter
then contents of the PATH variable in an MS-DOS prompt (terminal)
session. Can anyone here tell me?

Andy

If I understand what you are asking.
Command Prompt Properties
Start in: [whatever
 
Tom Porterfield said:
Instead of altering the registry, you can use the UI. Right click on My
Computer and select Properties. This will bring up your System
Properties. Go to the Advanced tab and click the Environment Variables
button. There you can modify all environment variables, including PATH.

This will not affect the PATH in a command window.
In the registry, there are two different keys depending on whether you
want the portion of the path that applies to all users (the machine
version) or to a specific user. The two locations are:

HKCU\Environment
HKLM\System\CurrentControlSet\Control\Session Manager\Environment


This will not affect the PATH in a command window.
 
M.I.5¾ said:
This will not affect the PATH in a command window.

You need to figure out what is wrong with your command window as it
works perfectly here. It modifies the path for all applications
including cmd.exe. If cmd.exe is already running prior to you making
the change to path, then you need to exit that command window and start
a new one. The new command window will pick up the change made to any
environment variables, including path.
This will not affect the PATH in a command window.

I will not repeat the same comment as you have done, simply read again
what I said above. The only difference is if you only change the
registry key then you'll also need to do something to make sure an
environment settings change message is broadcast to the system. Once
that is done, any applications that listen for those, or any
applications that are started after the broadcast, including a new
command window, will be running with the new environment settings.
 
Tom Porterfield said:
You need to figure out what is wrong with your command window as it works
perfectly here. It modifies the path for all applications including
cmd.exe. If cmd.exe is already running prior to you making the change to
path, then you need to exit that command window and start a new one. The
new command window will pick up the change made to any environment
variables, including path.

I have been trying to figure out for years where the command window gets its
PATH from without any success. The text string for PATH does not appear in
the registry anywhere nor in any file on the system. When a command window
is opened, it contains a completely different PATH string than the locations
to which you refer.
 
M.I.5¾ said:
I have been trying to figure out for years where the command window gets its
PATH from without any success. The text string for PATH does not appear in
the registry anywhere nor in any file on the system. When a command window
is opened, it contains a completely different PATH string than the locations
to which you refer.

Since you say for years, and Vista is new, you must be referring to an
earlier version of Windows. What version of Windows are you working with?
 
Tom Porterfield said:
Since you say for years, and Vista is new, you must be referring to an
earlier version of Windows. What version of Windows are you working with?

Why would I be posting about Vista in this newsgroup? The newsgroup name is
a clue.
 
From Windows XP Help:

If you place the path command in your Autoexec.nt file, it automatically
appends the specified MS-DOS subsystem search path to the Windows XP
search path every time you log on to your computer. Cmd.exe does not use
the Autoexec.nt file. When started from a shortcut, Cmd.exe inherits the
environment variables set in My Computer/Properties/Advanced/Environment.
 
M.I.5¾ said:
Why would I be posting about Vista in this newsgroup? The newsgroup name is
a clue.

Then "for years" was an exaggeration.

If you are referring to command prompt windows for cmd.exe, the default
command line processor in XP and Vista, then going to Properties of My
Computer->Advanced->Environment Variables is the way to do it.

If you are talking about the 16 bit command.com, then you will want to
modify autoexec.nt in %windir%\system32 as that it where it picks up its
path statement.
 
Tom Porterfield said:
Then "for years" was an exaggeration.

Why? Windows XP has been around for over 3 years. Since that is more than
1, "for years" is entirely correct.
If you are referring to command prompt windows for cmd.exe, the default
command line processor in XP and Vista, then going to Properties of My
Computer->Advanced->Environment Variables is the way to do it.

That is what you said before, but adding to the end of the PATH variable
adds nothing to the end of the PATH used in the command window.
If you are talking about the 16 bit command.com, then you will want to
modify autoexec.nt in %windir%\system32 as that it where it picks up its
path statement.

I am talking about the official XP command window (I assume the 16 bit
window to which you refer is the legacy MSDOS.EXE window).
 

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

Back
Top