From: Rob Biedenharn Date: 2008-11-13T10:30:31+09:00 Subject: Re: Need tutoring on using a path environment variable On Nov 12, 2008, at 7:20 PM, Rolando Abarca wrote: > On Nov 12, 2008, at 6:22 PM, dkmd_nielsen wrote: >> Let's provide more information. The contents of pw_path include >> this: >> >> C:\PW\firstprep;C:\PW\rapid\docs;C:\PW\la;C:\PW\rapid;c:\pw\pst; >> >> And the application I want to execute is presort.exe, which is >> located >> in c:\pw\pst; >> >> I would like to be able to tell the O/S you have to look in the above >> folders to find presort.exe, just as you would using PATH. In a >> sense, I would like to temporarily merge the contents of pw_path into >> the search path of PATH. >> >> Is that better? > > you can always store the path before and reset it after the system > call: > > old_path = ENV['path'] > ENV['path'] << ENV['PW_PATH'] > system(...) > ENV['path'] = old_path > >> dvn > > regards, > -- > Rolando Abarca M. Of course, doing that kind of thing in Ruby should look like: begin old_path = ENV['path'] ENV['path'] << ENV['PW_PATH'] system(...) ensure ENV['path'] = old_path end -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com