Setting Windows Environment Variables

Thanks a lot Jan.

Think I'll stick to the original idea of using NSIS to set up the machine...

Regards

Gem

···

-----Original Message-----
From: Jan Svitok [mailto:jan.svitok@gmail.com]
Sent: 14 August 2006 17:08
To: ruby-talk ML
Subject: Re: Setting Windows Environment Variables

               *** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.
     Keep this in mind if you answer this message.

On 8/14/06, Cameron, Gemma (UK) <gemma.cameron@baesystems.com> 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.

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

If you need to setup machine's global environment, maybe you can use
Win32OLE or Win32/registry modules (actually I don't have a clue how
it's done orm where it's stored except for manual clicking :wink:

I've used Win32OLE (i.e. COM interface) for (partially) configuring
machine via WMI.

J.

···

On 8/14/06, Cameron, Gemma (UK) <gemma.cameron@baesystems.com> wrote:

Thanks a lot Jan.

Think I'll stick to the original idea of using NSIS to set up the machine...