Replace line %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""
with
CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
You are not aware of it but while typing commands in command line, after first, you got a new instance of cmd.exe and next commands are typed in this new instance. You will need two EXIT
commands to exit command prompt.
Typing commands, you could just type "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
instead of %COMSPEC% ...
, but in batch it would break batch execution, so you have to prepend CALL
.