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
 
Re: What's the registry key to alter the PATH environment in an MS-DOSprompt

Andrew Falanga wrote:
> 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
--
Tom Porterfield
 
On Jul 5, 1:10 pm, Tom Porterfield <tppor...@mvps.org> wrote:
> Andrew Falanga wrote:
> > 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
> --
> Tom Porterfield


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" <af300wsm@gmail.com> wrote in message
news:1183663332.991327.268490@a26g2000pre.googlegroups.com...
> On Jul 5, 1:10 pm, Tom Porterfield <tppor...@mvps.org> wrote:
>> Andrew Falanga wrote:
>> > 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
>> --
>> Tom Porterfield

>
> 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 Falanga wrote:
> 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" <tpporter@mvps.org> wrote in message
news:%239xBhgzvHHA.3560@TK2MSFTNGP02.phx.gbl...
> Andrew Falanga wrote:
>> 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.
>


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.

> --
> Tom Porterfield
 
Re: What's the registry key to alter the PATH environment in an MS-DOSprompt

M.I.5¾ wrote:
>> 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.


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.

>> 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.


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
 
"Tom Porterfield" <tpporter@mvps.org> wrote in message
news:%23hljvOhwHHA.3400@TK2MSFTNGP03.phx.gbl...
> M.I.5¾ wrote:
>>> 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.

>
> 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.
 
Re: What's the registry key to alter the PATH environment in an MS-DOSprompt

M.I.5¾ wrote:
> 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
 
"Tom Porterfield" <tpporter@mvps.org> wrote in message
news:OPAvm1twHHA.5008@TK2MSFTNGP05.phx.gbl...
> M.I.5¾ wrote:
>> 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?


Why would I be posting about Vista in this newsgroup? The newsgroup name is
a clue.
 
Re: What's the registry key to alter the PATH environment in an MS-DOSprompt

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.



Andrew Falanga wrote:

> 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
>
 
Re: What's the registry key to alter the PATH environment in an MS-DOSprompt

M.I.5¾ wrote:
> "Tom Porterfield" <tpporter@mvps.org> wrote in message
> news:OPAvm1twHHA.5008@TK2MSFTNGP05.phx.gbl...
>> M.I.5¾ wrote:
>>> 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?

>
> 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
 
"Tom Porterfield" <tpporter@mvps.org> wrote in message
news:uE1C3z8wHHA.3636@TK2MSFTNGP05.phx.gbl...
> M.I.5¾ wrote:
>> "Tom Porterfield" <tpporter@mvps.org> wrote in message
>> news:OPAvm1twHHA.5008@TK2MSFTNGP05.phx.gbl...
>>> M.I.5¾ wrote:
>>>> 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?

>>
>> Why would I be posting about Vista in this newsgroup? The newsgroup name
>> is a clue.

>
> 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).
 
Back
Top