Re: Persisting env vars in cmd windows
- From: "Richard" <RichardDummyMailbox58407@xxxxxxxxxxxxxxxxxxx>
- Date: 13 Nov 2006 10:54:25 -0800
Hi Pegasus,
I note that you're using the Start command to launch your
various batch files.
Yes, that allows me to start a Ruby/Rails development session with a
set of minimized Command windows running helpful tools.
This is somewhat unusual but I suppose
you have your reasons for it.
Like Hamlet, there's a method to my madness :-)
These batch commands start the:
- Rails breakpointer, which listens for encounters with breakpoint
stmts
- Rails "log resetter", which clears the log file
- local webserver
- Embedded Ruby application as a sandbox for testing stmts/routines
I want to be able to invoke them separately as needed, but
collectively at the start a Ruby/Rails development session. This works
great for my purposes.
setx.exe (Windows Resource Kit)
setenv.exe (ftp://barnyard.syr.edu/pub/vefatica/setenv.exe)
Thanks for these. I looked them over carefully:
I note that you're using the Start command to launch your
various batch files.
Yes, that allows me to start a Ruby/Rails development session with a
set of minimized Command windows running helpful tools.
This is somewhat unusual but I suppose
you have your reasons for it.
Like Hamlet, there's a method to my madness :-)
These batch commands start the:
- Rails breakpointer, which listens for encounters with breakpoint
stmts
- Rails "log resetter", which clears the log file
- local webserver
- Embedded Ruby application as a sandbox for testing stmts/routines
I want to be able to invoke them separately as needed, but
collectively at the start a Ruby/Rails development session. This works
great for my purposes.
setx.exe (Windows Resource Kit)
setenv.exe (ftp://barnyard.syr.edu/pub/vefatica/setenv.exe)
Thanks for these. I looked them over carefully:
-- The -u switch causes both of them to store the name=>value in the
HKEY_CURRENT_USER\Environment key. From the Control Panel perspective,
adds them to the User env. variables.
-- The -m switch targets the
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session
Manager\Environment key and the System env. variables.
-- If invoked from a Command Window, both commands (regardless of the
switch provided) require invocation of a new command window before the
their effects will be felt.
-- Bottom line for me: it's great to have these commands available.
The -m and -u switches yield the same effect in my humble lab: I only
run under a single user account. I speculate that the setenv.exe pgm
was written before Microsoft made setx available. I didn't notice any
additional functionality in serenv.exe, though I didn't check that
carefully.
To set a variable globally ***and*** in the curren process,
use these two commands in sequence:
set name=Richard
setx name Richard -m
In the case of execution from within a Command Window, that sequence
doesn't appear to me to make the value of "name" available in the
current process, since there's now way to get the Command window to
refresh it's cached copy of the Registry. Do you agree?
Again, thanks for the guidance. It saved me a lot of time.
Best wishes,
Richard
Pegasus (MVP) wrote:
You're doing very nicely with your batch file commands.
I note that you're using the Start command to launch your
various batch files. This is somewhat unusual but I suppose
you have your reasons for it.
Setting environmental variables by a direct registry hack
is naughty and should be avoided. Much better to use one
of the following commands:
setx.exe (Windows Resource Kit)
setenv.exe (ftp://barnyard.syr.edu/pub/vefatica/setenv.exe)
To set a variable globally ***and*** in the curren process,
use these two commands in sequence:
set name=Richard
setx name Richard -m
"Richard" <RichardDummyMailbox58407@xxxxxxxxxxxxxxxxxxx> wrote in message
news:1163268901.683181.96700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Pegasus,
It's always a little disappointing when preparing a fine batch file
solution for a poster and when that person takes no further interest
other than using the ready made solution. There is much more fun
in showing a poster what can be done, i.e. responding to a lively
interest from that person.
I agree fully with you. I haven't had the same experience in on-line
communication, but I'm reminded of my 13-yo grandson when he offered
this summer to spend two hours per week with me studying math if I'd
get him a cell-phone. I jumped on it and got him to learn the Binomial
Theorem, using Logarithms with interpolation, developing a recursive
formula for Pi using Archimedes method, deriving the derivative of
x^n. He's really a gifted kid, but then he switched from home
schooling to public Middle School and didn't have the will to continue.
It's sad. He didn't want to disappoint me, but I didn't want to
force him to continue. I just took back his toy. Maybe the desire for
it will inspire him again.
%PATH:~10,5%
Understood, thanks. I just didn't realized that notation applied to
strings generally.
Just to show you how I profited from your previous guidance, here's my
one-click setup for developing Ruby/Rails apps:
A000_SetupPrmpDevelopment.bat
-------------------------------------------------
Call CreatePathAndSymbols.bat _Pf Prmp
Start "Start Local WebServer" /MIN A010_StartLocalWebServer.bat
Start "Start Breakpointer" /MIN A020_StartBreakpointer.bat
Start "Clear Log Files" /MIN A030_ClearLogFiles.bat
Start "Start ERB" /MIN A040_StartERB.bat
Start "Start SearchDir" /MIN A050_StartSearchDir.bat
A010_StartLocalWebServer.bat
---------------------------------------------
@echo off
call CreatePathAndSymbols.bat _Pf Prmp
echo ::
echo :: Starting WebBrickServer
echo :: in %AppDir%
echo ::
@echo on
ruby script/server
etc. I'll probably publish this group after I've used with them for a
while, e.g. after deciding whether I want to start up the database
system every time, or maintain that as a discrete step. I like have
the separate batch files that can be invoked stand-alone, but also
being able to invoke some of them collectively with minimal redundancy.
This is really simple batch progamming, but I needed some
suggestions to "get it right" (according to my likes.)
There is one redundancy I will eliminate: the _Pf and Prmp parameters
(representing Client and Project) by invoking within the A000_Setup a
.reg file that creates persistent environment variables for RubyOnRails
Client and Project, thus allowing for the elimination of _Pf and Prmp
from the CreatePathAndSymbols invocation.
Again, I'm grateful for your help and interested in any additional
comments/suggestions/advice you may wish to share.
Best wishes,
Richard
.
- References:
- Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Re: Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Re: Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Re: Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Re: Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Re: Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Re: Persisting env vars in cmd windows
- From: Richard
- Re: Persisting env vars in cmd windows
- From: Pegasus \(MVP\)
- Persisting env vars in cmd windows
- Prev by Date: Re: msgina.dll error after updates - won't boot
- Next by Date: Re: Persisting env vars in cmd windows
- Previous by thread: Re: Persisting env vars in cmd windows
- Next by thread: Re: Persisting env vars in cmd windows
- Index(es):
Relevant Pages
|