Batch - How to return a value from a batch file?

Viewed 9718

I know how to return a value from a function in the same batch file, but I've found some problems in returning a value from a different batch file. Here is an example:

File 1.cmd

SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

set number=1
call 2.cmd

echo. %number%

ENDLOCAL
exit /B

File 2.cmd

SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

ENDLOCAL & set number=2
exit /B

And the output is still 1. Is there any solution?

2 Answers
Related