Re: Persisting env vars in cmd windows



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



.



Relevant Pages

  • Re: Persisting env vars in cmd windows
    ... When you ask about combining your various batch files ... @echo off ... I opened three command windows and exectuted two bath ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Persisting env vars in cmd windows
    ... more about batch files as you go on, ... echo The time is %time::=.% ... But the piece de resistance was the "start" command, ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: How to transfer files to a Laptop efficiently?
    ... then consider Microsoft's SyncToy. ... Source being the mydocs / wallpapers folder Note the *.* meaning all ... echo Active Desktop Calendar ... If you don't know batch files then I might want to say, ...
    (microsoft.public.windowsxp.general)
  • Re: Persisting env vars in cmd windows
    ... even though it applies to any command, e.g. echo, copy, ... Similarly the syntax for the extremely powerful "for" command ... more about batch files as you go on, ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Spool in SQL*Plus without SQL statments
    ... ECHO does not affect the display of commands ... Oh and to get rid of the column heading underline I asked about ... web; not oracle docs though). ...
    (comp.databases.oracle.misc)