Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Setting Windows Environment Variables

Reply
Thread Tools

Setting Windows Environment Variables

 
 
Cameron, Gemma (UK)
Guest
Posts: n/a
 
      08-14-2006

Hi all!

I'm another Ruby noob and wondered if any of you can help me with my=
problem.=0D

I've have been tasked with writing some rake files to automate parts of our=
project and to begin I'm trying to automate the setup of the build=
machine. The first task is to set the environment variables.=0D

Can this be done in Ruby without using system("%PATH% =3D=
%PATH%;c:\ruby\bin") etc.?

Thanks in advance!!!! ( :

Regards

Gem

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

 
Reply With Quote
 
 
 
 
Jan Svitok
Guest
Posts: n/a
 
      08-14-2006
On 8/14/06, Cameron, Gemma (UK) <(E-Mail Removed)> wrote:
>
> Hi all!
>
> I'm another Ruby noob and wondered if any of you can help me with my problem.
>
> I've have been tasked with writing some rake files to automate parts of our project and to begin I'm trying to automate the setup of the build machine. The first task is to set the environment variables.
>
> Can this be done in Ruby without using system("%PATH% = %PATH%;c:\ruby\bin") etc.?
>
> Thanks in advance!!!! ( :


ENV['PATH'] += "c:\ruby\bin"

will be vaild only in processes that you'll start from your script, in
other words, you cannot modify parent environment. (you could do by
some batch file wizardry)

J.

 
Reply With Quote
 
 
 
 
Austin Ziegler
Guest
Posts: n/a
 
      08-14-2006
On 8/14/06, Robert Dober <(E-Mail Removed)> wrote:
> ENV cannot be assigned too.


>> ENV["PATH"]

=> "C:\\Ruby\\bin;..."
>> ENV["PATH"] += ";C:\\tmp"

=> "C:\\Ruby\\bin;...;C:\\tmp"
>> system("cmd")

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\home>PATH
PATH=C:\Ruby\bin;...;C:\tmp

The environment CAN be assigned to. What you can't do is propagate it
upwards. Any processes you spawn from your Ruby application will use
your new environment table, but you can't call a Ruby application to
set your environment in its parent.

-austin
--
Austin Ziegler * http://www.velocityreviews.com/forums/(E-Mail Removed) * http://www.halostatue.ca/
* (E-Mail Removed) * http://www.halostatue.ca/feed/
* (E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting environment variables Steve Java 6 05-01-2007 06:44 PM
Setting an environment variable from another environment variable marcwentink@hotmail.com Java 5 04-04-2007 10:39 PM
setting environment variables using windows batch file Afaque Ahmad Ruby 2 05-26-2005 12:36 PM
Setting Environment Variables Rick Kasten Perl 2 07-07-2004 07:43 PM
how to set .net environment variables - a one time setting by the administrator =?Utf-8?B?YnNmbDQ0?= ASP .Net 0 05-12-2004 12:56 PM



Advertisments