I'm afraid I cannot be 100% sure on this issue and I cannot add it to a comment yet so I have to put it here.
1.Does anyone know why this is happening?
- I'd Imagine this is happening because when you install SQL Server it will add specific paths to the Windows Environment Variables. As the batch script is used to install the SQL Server edition I would guess that it is not refreshing the Windows Environment Variables, meaning that the SQLCMD.exe file contained within C:\Program Files\Microsoft SQL Server\100\Tools\Binn\ (Or whereever you are installing it is not cached).
2.Is there a solution that involves launching a single .bat file only?
- If you are installing it to a default location each time, for instance the C:\Program Files\Microsoft SQL Server. Then you might be able to just launch the SQLCMD straight from there. I.E.
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.exe -q etc....
You might be worth creating a variable to that path to make it easier.
I don't know of a process from a batch script to refresh or look for new Windows Environment Variables, however that i'd imagine is the likely cause.