Talk:PATH (variable)

Latest comment: 9 years ago by Dlw20070716 in topic Need more helpful article

Capacity

edit

What is the maximal length of PATH string? Infovarius (talk) 13:09, 5 July 2012 (UTC)Reply

it's platform dependent, typically 1024 chars
This is not correct. There is no limit other than ARG_MAX if you use the Bourne Shell or other compliant shells. csh/tcsh however have a general limit of 1024 chars for environment variables. Non standard-compliant platforms such as Win-DOS however may have limits related to PATH. Schily (talk) 08:38, 17 April 2015 (UTC)Reply
The Open Group does not appear to provide a number for the minimum; they refer exclusively to symbols ARG_MAX, _POSIX_ARG_MAX, etc., and refer to those as a system imposed limit (that is, it is implementation dependent). The rationale does not give a number either, indicating that there was no strong agreement among legacy systems. On a POSIX-compliant system, you can use getconf to show the particular limits which are in effect for that particular system. TEDickey (talk) 10:28, 17 April 2015 (UTC)Reply
Microsoft states that "The maximum size of a user-defined environment variable is 32,767 characters. There is no technical limitation on the size of the environment block. However, there are practical limits depending on the mechanism used to access the block. For example, a batch file cannot set a variable that is longer than the maximum command line length."  — Loadmaster (talk) 22:47, 17 April 2015 (UTC)Reply

Need more helpful article

edit

This article needs to be more helpful. Most people looking for PATH information are looking for how to set it, and why the system can't find their executable even after they have set it. There are many possible sources for telling you how to set it (permanently or temporarily) on most common operating systems. Far more rare are the articles clueing you in to the fact that changing the PATH in a source script somewhere doesn't immediately cause it to propagate to all current shell sessions. You may need to start a new shell or even log off and log back into your account to see your changes in all their glory. Dlw20070716 (talk) 22:43, 27 August 2015 (UTC)Reply

PowerShell

edit

Agree with the above talk topic. This is tied to the concept of process environments, where processes inherit them from their parent processes… which includes PATH. Furthermore, no mention is made of PowerShell 5, PowerShell 6 (Core), which uses $Env:Path.