Actually it's quite simple. Look at how we call the file:
call "bb.bat" anyname a b c dcall "bb.bat" tells the interpreter to run bb.bat in the same cmd.exe process as from where it was called. Thus, aa.bat and bb.bat run in only one process which is the reason why leaving out
@echo off has no effect and which is the reason why both files share the same scope for variables.
anyname a b c d are the 5 (space-separated) arguments we pass to bb.bat. In bb.bat you can access them with the parameters %1 (anyname) till %5 (d). I used the tilde (~) that expand the values without surrounding quotation marks (if any). (This is best practice as well as surrounding an assignment with quotation marks. Both are you chronically ignoring ...)
All passed arguments can be accessed at once by using %* that expands to
anyname a b c d in this case.
Looking at what happens in bb.bat. First line is
call :%~1 %*which expands to
call :anyname anyname a b c dAs you can see we again pass
anyname a b c d to the label where it can be accessed via %1 ... %5 just as above.
the main works even without AA= in the bb.bat
What do you expect such a line should do? I never saw something like that in a batch code and I assume it will rather cause an error message.
Steffen