refreshing environment variables while processing batch file

P

Pedro CR

hi

i am trying to write a bath file that first calls a wsh script that sets an
environment variable and later in the same batch file that variable is
needed as an argument to a program that is called.
the problem is that, although the script sets the envirnment variable
correctly, it is not available to the console who called the script. I
assume that the problem is that the console does not refresh its environment
variables, because if I open a new console, the environment variable is
there.

What I wanted to know was if there a way to force the console to reload the
environment variables while processing the batch file, and making the new
environment variable visible to the console who ran it and batch file being
processed in that console.

thanks in advance
pedro
 
J

Jerold Schulman

hi

i am trying to write a bath file that first calls a wsh script that sets an
environment variable and later in the same batch file that variable is
needed as an argument to a program that is called.
the problem is that, although the script sets the envirnment variable
correctly, it is not available to the console who called the script. I
assume that the problem is that the console does not refresh its environment
variables, because if I open a new console, the environment variable is
there.

What I wanted to know was if there a way to force the console to reload the
environment variables while processing the batch file, and making the new
environment variable visible to the console who ran it and batch file being
processed in that console.

thanks in advance
pedro

Try using SETENV.EXE to set the environment variable.
See tip 4928 » SETENV.EXE is a freeware replacement for SETX.EXE, and it has more functionality.
in the 'Tips & Tricks' at http://www.jsifaq.com

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top