# Faster vcvars32.bat

Recently I noticed vcvars32.bat was taking up a significant portion of my compile time. Usually this isn’t a problem if the console that ran vcvars32.bat only needs to run the command once. However in some cases the environment variables setup by vcvars32.bat need to be set each time a batch file build script is run.

After looking around inside of vcvars32 I noticed it was calling some regexes to see if various folders existed. This is almost certainly the source of slowness (about 0.3 seconds on my machine). I’ve been wanting to keep my compile times under a second, so freeing up 1/3rd of a second would be nice!

In the end I extracted just the pieces I needed to run cl.exe, with some extra include and lib directories. Running the following batch file shouldn’t introduce any measurable hit on compile times (for VS 2013):

Share