delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/19/20:47:23

From: "A. Sinan Unur" <asu1 AT cor-nell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: passing variable to calling .bat file
Date: 19 Jul 2002 23:34:58 GMT
Organization: Cornell University
Lines: 32
Sender: asu1 AT cornell DOT invalid (on pool-141-149-207-12.syr.east.verizon.net)
Message-ID: <Xns9250C734A9FD5asu1cornelledu@132.236.56.8>
References: <3d37ebcc$0$25810$91cee783 AT newsreader02 DOT highway DOT telekom DOT at>
NNTP-Posting-Host: pool-141-149-207-12.syr.east.verizon.net
X-Trace: news01.cit.cornell.edu 1027121698 2690 141.149.207.12 (19 Jul 2002 23:34:58 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 19 Jul 2002 23:34:58 GMT
User-Agent: Xnews/5.04.25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Florian Sukup" <f DOT sukup AT mobilkom DOT at> wrote in
news:3d37ebcc$0$25810$91cee783 AT newsreader02 DOT highway DOT telekom DOT at: 

> setenv() did not work at the test I did, I tried work arounds but no
> success.

setenv cannot modify the master environment

here is something i used before:

rem === setvar.bat ===
set myvar <EOF> <---  make sure there is no newline here.


rem === main.bat ===
copy /y setvar.bat tmp.bat
prog.exe > tmp.bat
call tmp.bat

this works if prog.exe prints the value of myvar to stdout.

for multiple variables etc, your program should accept the name of the 
batch file to generate, and then write the set var=value lines to that 
file. you can then call the generate file in your batch script.

sinan.

-- 
A. Sinan Unur
asu1 AT c-o-r-n-e-l-l DOT edu
Remove dashes for address
Spam bait: mailto:uce AT ftc DOT gov

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019