1@echo off 2:: Batch file to run Visual Studio with CAFE_ROOT_DOS set locally 3:: The name must be: foo.sln.bat 4:: where foo.sln is the target file to open with devenv. 5 6:: CAFE_ROOT_DOS is figured out automatically, 7:: assuming the current directory contains "\system\src\tool" 8 9:: We'll remove everything after *\system\src\tool from CD. Step 1: 10set _endbit=%CD:*\system\src\tool=% 11:: Step 2. Now remove that end bit from the current path: 12call set _result=%%CD:%_endbit%=%% 13:: CAFE_ROOT is three levels up from there 14:: (we didn't want to match only "system" as it might not be unique enough) 15set CAFE_ROOT_DOS=%_result%\..\..\.. 16 17:: Start devenv (using an environment var it always set upon installation) 18start "%VS90COMNTOOLS%..\IDE\devenv.exe" %~n0 19