yipo
2/27/2017 - 9:25 AM

An alternative convention to call/implement a modular script

An alternative convention to call/implement a modular script

@echo off
echo In sc(%1, %2, %3)

set VAR=sc
exit 3
@echo off
echo In sb(%1, %2, %3)

echo Before sc
cmd /c sc.bat c1 c2 c3
echo After sc (error code: %ERRORLEVEL%, var: %VAR%)

set VAR=sb
exit 2
@echo off
echo In sa(%1, %2, %3)

echo Before sb
cmd /c sb.bat b1 b2 b3
echo After sb (error code: %ERRORLEVEL%, var: %VAR%)

set VAR=sa
exit 1
@echo off
set VAR=42

echo Before sa
cmd /c sa.bat a1 a2 a3
echo After sa (error code: %ERRORLEVEL%, var: %VAR%)

pause