Reputation: 47
( Different from Batch file include external file for variables )
What I'm trying to do is read a batch file, from another batch file. The parent batch file calls upon the child batch file to retrieve a variable from an INI file (the childs sole purpose). It then echos the returned value, and exits. What I want is for the parent batch to pick up this output and use it as a variable for its own operations.
So to clarify: I'm not setting a value in the child process, and would prefer if I didn't have to, because this child process is called twice, to do the same operation twice, but to retrieve different values.
Upvotes: 0
Views: 316
Reputation: 56189
the usual way to get a command's output is a for
construct:
b.bat
@echo hello
a.bat:
for /f %%i in ('b.bat') do set output=%%i
echo %output%
Upvotes: 1