# Re: Setting Windows Environment Variables

**URL:** <https://www.ruby-forum.com/t/re-setting-windows-environment-variables/64960>\
**Category:** Ruby\
**Created:** [August 15, 2006, 2:20pm UTC](https://www.ruby-forum.com/t/re-setting-windows-environment-variables/64960 "2006-08-15T14:20:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CameronS\_Gemma\_SUK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/45deac/32.png) [@CameronS\_Gemma\_SUK](https://www.ruby-forum.com/u/CameronS_Gemma_SUK)\
**Post date:** [August 15, 2006, 2:20pm UTC](https://www.ruby-forum.com/t/re-setting-windows-environment-variables/64960/1 "2006-08-15T14:20:59Z")

</div>

Thanks to everyone for your input. I will investigate other routes. ( :

Still thinking in Ant you see!

Regards

Gemma Cameron

* * *

This email and any attachments are confidential to the intended  
recipient and may also be privileged. If you are not the intended  
recipient please delete it from your system and notify the sender.  
You should not copy it or use it for any purpose nor disclose or  
distribute its contents to any other person.

* * *

---

<div class="post-metadata">

**Author:** ![CameronS\_Gemma\_SUK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/45deac/32.png) [@CameronS\_Gemma\_SUK](https://www.ruby-forum.com/u/CameronS_Gemma_SUK)\
**Post date:** [August 15, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/re-setting-windows-environment-variables/64960/2 "2006-08-15T14:21:01Z")

</div>

Have a look at this

> **[Technical documentation](https://learn.microsoft.com/en-us/docs/)**

and then here

[http://www.ruby-doc.org/stdlib/libdoc/Win32API/rdoc/classes/Win32/Registry/API.html](http://www.ruby-doc.org/stdlib/libdoc/Win32API/rdoc/classes/Win32/Registry/API.html)

You might be in luck.

cheers  
lyndon

---

<div class="post-metadata">

**Author:** ![CameronS\_Gemma\_SUK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/45deac/32.png) [@CameronS\_Gemma\_SUK](https://www.ruby-forum.com/u/CameronS_Gemma_SUK)\
**Post date:** [August 15, 2006, 3:04pm UTC](https://www.ruby-forum.com/t/re-setting-windows-environment-variables/64960/3 "2006-08-15T15:04:22Z")

</div>

On 8/15/06, Lyndon S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You might be in luck.

Not really. You can’t change the environment of an already running  
process that isn’t yourself. Even if one were to go into the System  
control panel and change the environment variables, any shortcut  
launchers (as I often use) will themselves need to be relaunched to  
take advantage of the updated environment variables. Certainly, there  
must be a way to refresh the internal environment variable table based  
on the current registry settings, but that would be based on a global  
signal.

I’m not sure what the OP’s post about thinking in “ant” is, because  
Ant would be similarly limited. This is not a Ruby limitation; it is  
one of the few limitations that is essentially cross-platform and  
found on every platform in existence to the best of my knowledge. The  
only reason that shell script functions and DOS/Winodws batch files  
can affect the current level’s environment variables is that they are  
not in a separate process and are therefore just modifying the current  
process’s environment variables.

-austin
