Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My PATH is too full, so I need to put things in batch scripts like "cl.bat":

@echo off
%comspec% /k ""%ProgramFiles%\MICROS~1.0\Common7\Tools\VsDevCmd.bat""
call cl %*

Unfortunately this has a side effect keeping the script running in the background.

Note: I have also tried start cl %*, open cl %* and cl %*.

share|improve this question

1 Answer 1

The following works for my Visual Studio 2012 Express:

@echo off
setlocal

call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"
start "CL" /B cl.exe %*

endlocal

This will spawn an independent process and continue without wait. vsvars32.bat must not be started in a sub-shell. Otherwise, the adjustments of the environment won't survive the call

share|improve this answer
    
That didn't work, and when I added a similar line above it I got a large number of command prompt windows spawning. By not working I mean it doesn't give me a working cl command. –  stackoverflowuser95 Oct 2 '13 at 13:48
    
Try the revised script. Note that you have double double-quotes in your original script. –  Axel Kemper Oct 2 '13 at 13:59
    
Unfortunately that also didn't work. Running the commands manually on C/C++ Optimizing Compiler Version 17.00.60610.1 and it works, but not with the bat script. –  stackoverflowuser95 Oct 2 '13 at 15:41
    
Okay, based on your new edits there are no longer side-affects; however it (cl) doesn't produce any output. –  stackoverflowuser95 Oct 2 '13 at 15:43
    
Sorry for the confusion. The new version (see above) finally should work. Parameter /B prevents start to open a new window. –  Axel Kemper Oct 2 '13 at 16:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.