Talk:Environment variable/Archive 1

Changing environmental variables of other processes
In unix, how can a process change environment variable of other process? —The preceding unsigned comment was added by 59.145.65.2 (talk • contribs) 01:03, December 1, 2005  (UTC)
 * It can't. That would require one process to write in another process's private memory.  However, the exec* family of functions can take a list of environment variables to give to the new program which may be different than the current ones.  --ssd 12:30, 27 April 2006 (UTC)
 * It is possible of course, strictly speaking, using ptrace(2), but that's an incredibly ugly hack, so I wouldn't recommend it.--Dolda2000 00:54, 10 June 2006 (UTC)

It can't and that is no accident. When we generalized the PWB/UNIX mechanisms (1975)into Seventh Edition UNIX (1979), we wanted a simple, understandable, efficient way of generally passing a set of implicit arguments down a process tree. We did not want to accidentally create some odd interprocess communication mechanism akin to shared memory or semaphores, but inherently slow and special-purpose, and with tricky semantics and surprising race conditions.

We considered various mechanisms, but they were all pretty complex and sometimes confusing compared to the one finally implemented,which effectively treats environment variables just like the usual argument list (set once upon exec), not a list of shared variables whose values change dynamically.

JohnMashey (talk) 05:45, 10 February 2009 (UTC)

Windows environment variables
I was surprised to read in the article the environment changes would be globally visible under Windows. Thus, I went and tried it on a Windows system, and it does appear as if that is not the case. I had started to cmd.exe windows, changed PATH in one if them, checked it in the other, and noticed that it hadn't changed. As for them being stored in the registry, I believe that that is the default values, not the runtime values. Thus, I'm changing the article to reflect this. --Dolda2000 00:54, 10 June 2006 (UTC)
 * You're right, you cannot make globally visible changes to the environment variable list via the command line in Windows NT. Cmd.exe copies the defaults (set by the user in the System control panel applet) into a private list visible to just that console session.  The Set command works on this copy.  Any changes made via set are lost when you close the console.  Opening a new console reloads the variable list from the defaults. &mdash; EagleOne\Talk 04:04, 4 November 2006 (UTC)

Standard Windows env vars are decidedly not "dynamic". The article's opening sentence should read "Environment variables are a set of named values ..." or "Environment variables are a dynamic set of named values ..." It would be a good idea to document the Windows env vars that are dynamic, though:,  ,  ,  , and   (these are not returned by  ). ― Brianary (talk) 01:25, 23 October 2010 (UTC)

Beginning with digits
The checked build of WinDDK 6001.18002 sets an environment variable "386=1", but in a batch file, the line: if %386%==1 set ARCH=i386 expands to %3, the third parameter, instead I had to do: set | find "386=1" > nul if errorlevel 1 goto not386 set ARCH=i386 :not386

Such expansion does not occur on the command line, only in a batch file. Samjam (talk) 11:12, 9 September 2009 (UTC)

SystemDrive description wrong
First, the SystemDrive and SystemRoot text contradict each other. Second, correct is what is currently striked thru (try on any Windows system, if you don't believe. That is any that has separate boot and system drive...). --Xerces8 (talk) 16:02, 12 February 2008 (UTC)

Folder versus Directory
I think only one term should be used thru the article. Less confusing for a newby reader.

On a related note, are "system folder" and "Windows directory" one and the same ? --Xerces8 (talk) 13:26, 4 March 2008 (UTC)

Length limit?
On Linux is there any limit for the length of a value of an envirorment variable? Like can it be 1 MB of text? If there is a limit, what is it, and where is it defined? Miernik (talk) 23:14, 26 May 2008 (UTC)

Dumb this down
This really needs to be brought down to an introductory level. 67.189.104.78 (talk) 10:45, 27 July 2008 (UTC)

re: "Dumb this down": speak for yourself
If 67.189.104.78 can add useful introductory material to make this more approachable to those who've never used a command line, fine, but dumbing the article down is a dumb idea. I was looking in particular for information on the Windows %TIME% variable, which doesn't produce an immediately useful 24-hour hour value even if the machine is set to 24 hour time: if the hour is less than 10, the time value given by the machine will have a leading blank rather than a leading zero. I was particularly grateful to come across the code given here which allows recognizing that case and turning the time value into a usable 24-hour code with a leading zero as appropriate. Bravo!

Ludwig X (talk) 13:43, 2 March 2009 (UTC)

set (command)
...redirects here, to the #DOS and Windows section, but set refers to something else in other Linux contexts - it is a shell builtin that controls the shell's internal variables, which are not the same as environment variables (although can do some things I don't really understand with relation to the environment variables, which is mentioned, although not clearly, in this article).

Also, in the Windows section, set VARIABLE will display all environment variables starting with VARIABLE (%PATHEXT% comes to mind). 74.85.42.110 (talk) 06:14, 19 February 2009 (UTC)

Fixed entry for %HOMEDRIVE%
[Output on XP/Server 2003] C:\Documents and Settings\qa1>echo %homedrive% C:

[Output on Vista/Server 2008] C:\Users\qa1>echo %homedrive% C: —Preceding unsigned comment added by 192.25.240.225 (talk) 16:49, 29 April 2009 (UTC)

Focus?
It looks to me like the focus should be on environment variable at large, but the article is on UNIX environment variable intermixed with Windows environment variables. I think it might be a good idea to focus on environment variables in general and just note how unix-like operating systems and their shells usually treat them as well as Windows. If a table which contains common variables is still to be present, it should give an overview of both unix-like operating system variables and the equivelant Windows variable (if both exists), not exclusively focus on any type of operating system -- that is better left for another article on that type of operating system environment variables (I think I just proposed a split). —Preceding unsigned comment added by FrederikHertzum (talk • contribs) 15:49, 24 May 2009 (UTC)
 * Yes, this article desperately needs to be split into three: general, Unix, Windows. – gpvos (talk) 15:42, 2 March 2010 (UTC)

Variables are not case sensitive
The statement about environment variables being case sensitive is wrong (at least in its current absolute meaning). On Windows the behavior is that "set" displays the name exactly as it was entered (so it remembers the upper/lower case), but you can use the variable case insensitive, so writing %ProgramFiles% or %PROGRAMFILES% is the same on Windows. —Preceding unsigned comment added by 217.110.34.4 (talk) 10:28, 23 February 2011 (UTC)

Reference for above statement: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true —Preceding unsigned comment added by 217.110.34.4 (talk) 10:30, 23 February 2011 (UTC)

Mac OS X
There's no mention of setting environment variables on Mac OS X. While it can be done for the shell, unlike Unix or Linux, the shell variables are not exported when running a GUI application, in which case it needs to be set via environment.plist, as described in http://developer.apple.com/library/mac/#qa/qa1067/_index.html. I'm tempted to write this myself but I haven't written a long block in such a high-profile Wikipedia page. Gglockner (talk) 21:09, 6 December 2011 (UTC)

Default variable set?
It is not clear whether there is a default set of variables that can be found throughout operating systems or in a vendor's operating systems. Can TEMP be used as the default minimum set to be expected to be present in all systems, not considering (malicious) user intervention? What is the constant in the history of the mentioned OS versions? — Preceding unsigned comment added by 64.134.156.30 (talk) 01:46, 15 February 2012 (UTC)

Manual page spam
I've undone the readdition of a huge wad of unencyclopedic content which mistakes this article for a programming / system administration guide. Such content belongs on Wikibooks. Chris Cunningham (user:thumperward) (talk) 13:54, 24 April 2013 (UTC)

I'm a little bit of a noob, but I noticed an essentially broken link.
This link in the External Links section (Environment Variable Reference, web address http://www.scriptlogic.com/support/CustomScripts/environmentVariableReference.html) no longer points to any useful information. It doesn't give anything like a 404 error, but it redirects to this site, https://support.quest.com/Default.aspx, being of no use to this article. Should this be completely deleted, or should something else happen? impinball (talk) 15:33, 4 June 2013 (UTC)
 * If the external link not usefull anymore, feel free just delete it. Dekart (talk) 18:29, 4 June 2013 (UTC)

Table removed?
Why was the table removed?

http://en.wikipedia.org/w/index.php?title=Environment_variable&diff=551959978&oldid=545837014

This was the edit that removed the table.

I do not agree with this change. It makes it far harder to see the different variables at a glance; which is the main reason I even used this wiki page.

Please add the table back. Should this not be done, then I guess I will try to add it back myself, though I don't know much about table editing. DAOWAce (talk) 06:41, 17 June 2013 (UTC)