Re: Persisting env vars in cmd windows

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi GO,

I think you're right. I just realized that as I was documenting a
detailed response to Pegasus. It's midnight, my time, right now, so
I'll try that out tomorrow.

Regards,
Richard


GO wrote:
Hi Richard,

Are these variables you are setting static or dynamic? That is are the
values changing through out the batch file and do those new values need be
be available to the other batch files? If the values are static, which is
what it sounds like, then you simply need to "call" the batch file containg
your "symbol-setter". So at the beginning of your utility batch file you
would have a line:
call <symbol-setter>.bat
where <symbol-setter> is the name of your batch file. If said batch file is
not located in your search path then you will have to specify the full path
to it's location (eg: C:\batchfiles\symbol-setter.bat).

If your variables are dynamic then you will most likely have to create a
temporary batch file that echos the variables and values and call that as
needed. There may be a more elegant way to do that but I'm not sure.

HTH,

Greg

Richard wrote:
I've got a .bat file that sets a number of symbols (environment vars)
that are useful in a number of other command windows associated with
one of several projects. Right now, I operate by
1 opening a command window
2 draging the name of the symbol-setting bat file into the new cmd
window and pressing Enter
3 draging the name of one of my utility bat files in the cmd window
and pressing Enter
4 proceeding manually entering other commands as needed.

I'd like to eliminate step 2 by invoking the symbol-setter at the
beginning of every other utility file. I tried this by using "cmd /c
symbol-setter.bat" to no avail. I believe that fails because the "cmd
/c" command starts a new session in which to set local env. vars and
then ends, never communicating with the invoking session.

The best solution I can conceive of is to manually write a .reg file
appropriate to each project in which I want persistant env. vars, thus
only needing to invoke that once at the inception of a project, maybe
with another one to delete all such entries should the project
ultimately be destroyed.

Any comments?

Regards,
Richard

.



Relevant Pages

  • Re: Running DOS and Batch Programs on XP
    ... Batch File: (empty) ... bring up the wthpro.exe program window. ... Cmd Line: C:\Webster2.bat ...
    (microsoft.public.windowsxp.general)
  • Re: How to read in data from the command window?
    ... Is the response read as one stream or individual lines. ... ADDRESS CMD cd prf ... followingerror messages in the command window; ... program or batch file. ...
    (comp.lang.rexx)
  • Re: AutoShutdown
    ... If I put this in a batch file do I have to prefix the shutdown with CMD ... We have to restart all of the machines because some people forget to ...
    (microsoft.public.windows.server.scripting)
  • Re: is this possible with bat file?
    ... start cmd /c program options_and_parameters ... Un saludo ... I have a need to have a batch file start another program but I don't want it to wait around for the program to exit or return. ... Can I do this with standard batch file or do I need to use WSH and vbscript? ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Persisting env vars in cmd windows
    ... that are useful in a number of other command windows associated with ... opening a command window ... draging the name of the symbol-setting bat file into the new cmd ... you should post the contents of your batch file. ...
    (microsoft.public.win2000.general)