diff --git a/win32/AsmParser/AsmParser.vcproj b/win32/AsmParser/AsmParser.vcproj
index 48162fd22b1..f596b5816f7 100644
--- a/win32/AsmParser/AsmParser.vcproj
+++ b/win32/AsmParser/AsmParser.vcproj
@@ -133,18 +133,16 @@
+ CommandLine="..\dobison.cmd llvmAsm debug $(InputName) $(InputPath)"
+ Outputs="$(InputName).cpp;$(InputName).h;$(InputName).output"/>
+ CommandLine="..\dobison.cmd llvmAsm release $(InputName) $(InputPath)"
+ Outputs="$(InputName).cpp;$(InputName).h;$(InputName).output"/>
@@ -113,7 +113,7 @@ echo #define LLVM_ON_WIN32 1 >>$(ProjectDir)..\llvm\Config\config.h"
@@ -124,7 +124,7 @@ echo #define LLVM_ON_WIN32 1 >>$(ProjectDir)..\llvm\Config\config.h"
@@ -135,7 +135,7 @@ echo #define LLVM_ON_WIN32 1 >>$(ProjectDir)..\llvm\Config\config.h"
diff --git a/win32/TableGen/TableGen.vcproj b/win32/TableGen/TableGen.vcproj
index 1c0012a3cf0..0049aee5c9d 100644
--- a/win32/TableGen/TableGen.vcproj
+++ b/win32/TableGen/TableGen.vcproj
@@ -161,18 +161,16 @@
+ CommandLine="..\dobison.cmd File debug $(InputName) $(InputPath)"
+ Outputs="$(InputName).cpp;$(InputName).h;$(InputName).output"/>
+ CommandLine="..\dobison.cmd File release $(InputName) $(InputPath)"
+ Outputs="$(InputName).cpp;$(InputName).h;$(InputName).output"/>
NUL
+if errorlevel 1 goto nobison
-:error
-echo Bison could not run. Using pre-generated files.
+rem Run bison.
+bison -p%1 %flags%%3.cpp %4 && move %3.hpp %3.h
+exit
+
+:nobison
+echo Bison not found. Using pre-generated files.
copy %~pn4.cpp %3.cpp
copy %~pn4.h %3.h
-
-:done
-exit 0
+exit
diff --git a/win32/doflex.cmd b/win32/doflex.cmd
index 5c0629d092b..b39d40b7539 100755
--- a/win32/doflex.cmd
+++ b/win32/doflex.cmd
@@ -6,14 +6,15 @@ rem source - input to bison
if "%1"=="debug" (set flags=-t) else (set flags=-t)
-rem Try and run flex. If it is present, great.
+rem Test for presence of flex.
+flex --help >NUL
+if errorlevel 1 goto noflex
+
+rem Run flex.
flex %flags% >%2.cpp %3
-if errorlevel 1 goto error
-goto done
+exit
-:error
-echo Flex could not run. Using pre-generated files.
+:noflex
+echo Flex not found. Using pre-generated files.
copy %~pn3.cpp %2.cpp
-
-:done
-exit 0
+exit