deepak singla
asked on
Return result to caller batch file
I have two batch files A.bat and B.bat. A.bat is calling to B.bat.
B.bat is doing some processing, and return back the result to A.bat. How A.bat can accept the return?
A.bat
@echo off
set str1=1,2,3,4,5
set str2=6,7,8,9
call B.bat %str1% %str2%
B.bat
@echo off
set str1=%1
set str2=%2
set str3=%str1%,%str2%
Expected that B.bat return %str3% (means 1,2,3,4,5,6,7,8,9) back to A.bat file So that A.bat used the result for further processing.
B.bat is doing some processing, and return back the result to A.bat. How A.bat can accept the return?
A.bat
@echo off
set str1=1,2,3,4,5
set str2=6,7,8,9
call B.bat %str1% %str2%
B.bat
@echo off
set str1=%1
set str2=%2
set str3=%str1%,%str2%
Expected that B.bat return %str3% (means 1,2,3,4,5,6,7,8,9) back to A.bat file So that A.bat used the result for further processing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the case of different batch files: The process is called piping. Thus the use of Echo to output the result to the standard pipe is the correct approach.
So I would thus use a slightly different syntax for the "function" result in a closed batch, call it a different flavor:
Open in new window