I would like to write a setup script that sets
some variables for the entire system like an installer.
When a new command prompt is opened, the values are now.
I would like to write a setup script that sets
some variables for the entire system like an installer.
When a new command prompt is opened, the values are now.
You don't have to dig that deep in order to accomplish. This a quick
way to get this done is through using the Ruby built-in ENV method. For
example to create a new environmental variable called 'foo' and assign
it the value 'bar' just issue the following:
ENV['foo']='bar'
then you can check the value by either issuing:
ENV['foo']
or else using the system method, passing along the set command:
open a new comand prompt
type
set
foo will not show up.
Oh sorry. Didn't see that you wanted these environmental variable to
persist between separate NTVDM shells. Michael's advice regarding the
registry.rb is on target...
To get the registry settings having to do with environment to stick
without rebooting you also need to broadcast a message to notify
processes of the change. Here's my revant code snippet: (Watch the urls
in my comments. they may wrap badly)
It took me a week of head-scratching to figure out that registry.rb
made the right changes, but they weren't being
accepted quite correctly - especially when you want to use other Env
variables in your definition. e.g. SRCTREE = %HOME%/blah/blah
Take a look at
ruby/ext/Win32API/lib/win32/registry.rb
I guess this is what you want.
Regards,
Michael
armin@approximity.com wrote:
> Sorry, but if you open a new command prompt
window, foo is not known.
>
> Try this:
> set foo="34" in one command prompt
>
> open a new comand prompt
> type
> set
> foo will not show up.
>
>
____________________________________________________
Start your day with Yahoo! - make it your home page