This is fairly simple:

Parent CMD:

call test.bat
::Must end in `.bat`
echo %test%
pause

Child CMD (test.bat):

set test="It Works!"