This behavior is to be expected. Temporary tables are automatically dropped when the session that creates them ends (global temp tables -- i.e. the ones that you are using -- can exist slightly longer if there are other sessions accessing them):
- This works as you expect it to in SSMS because you are executing them either in the same session / tab, or if executing them in their own tabs, then you are keeping all tabs open until you are done.
- When batch executing them, each session ends before the next session is started.
For the batch approach to work as you are wanting (temp tables created in first script remain until last script is done), you will need to concatenate the scripts together so that they execute in the same session.
Side note: Looking at the order in which your scripts are being executed, you should left-pad order numbers with 0s so that all numbers are always the same number of digits. Hence, use Table01.sql* instead of Table1.sql. Then they will sort in the expected order. Do not go by what you see in File Explorer since that program uses "natural" sorting which can sort numeric values within strings as if they were actual numbers, but doing file sorting in BAT / CMD scripts uses the simple sorting that you see in your SQLCMD screenshot.