@ECHO OFF cls IF "%1" EQU "help" ( ECHO %0 help -- display this help ECHO %0 clean target -- clean for "target" ECHO %0 target [run] -- build and run "target" GOTO EXITPOINT ) IF "%1" EQU "clean" ( vcbuild /clean TheSolutionFile.sln "%2|Win32" ) ELSE ( IF "%2" EQU "run" ( vcbuild TheSolutionFile.sln "%1|Win32" && path\to\the.exe ) ELSE ( vcbuild TheSolutionFile.sln "%1|Win32" ) ) :EXITPOINT
which is (obviously) saved in the same direction as my solution file. A trivial modification would allow passing the solution file through an environment variable, and one could always use vcbuild's understanding of a lone project file in the present directory but I tend to keep a shell open to the same location as my solution file.
Then again, at the moment I am using a file system hierarchy that looks sort of like this for most of my current stuff:
... SolutionFile.sln Project/ ProjectFile.vcproj Makefile # the big thing for conventional builds Makefile.compiler ... Source/ *.c, *.cpp, ... include/ *.h, *.hpp, ... lib/ # project specific library files Build/ Target/ # result of compiling (e.g. 'make target') ...