Talk:Environment variable

From Wikipedia, the free encyclopedia

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)

Contents

[edit] 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. — EagleOne\Talk 04:04, 4 November 2006 (UTC)


[edit] 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)

[edit] 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)

[edit] 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)