Mine, called DashboardEnv.cmd, looks like this on one of the machines where I have Visual Studio 2010 Express Edition installed:
@set PATH=C:\Program Files\Git\bin;%PATH%
As you can see by inspecting that file, it sets up the environment just like a Visual Studio command prompt, and then adds a bunch of useful stuff to the PATH environment variable: git, cmake, python, qmake, ninja and jom, to name a few. I have ninja and jom in the C:\dev\tools\bin directory -- they could be anywhere, you just have to add the right directory to the PATH here in this script.
Next, set up a cmd file in the same directory as the environment batch file to display a "developer cmd prompt."
Mine, called DashboardPrompt.cmd, looks like this:
@title Dashboard Prompt
@echo Environment set by "%~f0"
If you prefer the "git bash" prompt to the raw Windows cmd prompt, you can change the call COMSPEC line to:
@call "C:\Program Files\Git\bin\sh.exe" --login -i
After you have both of those setup, double click the prompt cmd file to test it out. Then you can create a shortcut to the prompt cmd file, put it on your desktop, or whereever you like, and then just double-click the shortcut to get a new instance of your customized developer prompt.
Some things I do to make the command prompt itself slightly less intolerable:
- edit the command prompt window properties: with the window open, click on the icon in the top left corner, and choose "Properties" from the menu
- modify the properties of the window to allow "select-and-Enter-key to copy, right-click to paste" behavior by choosing the "QuickEdit Mode" checkbox
- set the screen buffer height (number of scroll back lines) to 9999, the max allowed
- set the window size to something larger so you can see more text at once (120 by 40-50 is nice depending on your usual screen)
- set the font to Lucida Console, and choose a font size large enough to read
- if prompted, check "modify the shortcut that started this prompt" on the way out
The %~dp0 there means "drive letter (d) and full path of containing directory (p) without any double quotes (~) of this script file (arg 0) including the trailing '\' character (implicit in p)" -- so if you write a script that references another script in the same directory, using %~dp0 is a reliable way to reference it, regardless of how the batch file was invoked. See the output of "help for" in a Windows command prompt for all the gory details about possible letter codes you can use in such constructs.
So: to run dashboards or other automated builds with the same environment that you use for interactive development, you can write a script that uses your Env.cmd file.
Mine, called RunDashboards.cmd, looks like this:
@title Run Dashboards
@echo Running script "%~f0"
@echo. started on %DATE% at %TIME%
@echo Updating VTKLargeData...
@cd "C:\dev\My Tests\VTKLargeData"
@echo Updating VTKData...
@cd "C:\dev\My Tests\VTKData"
@echo Running VTK Release dashboard...
@cd "C:\dev\My Tests\VTK"
@ctest -S C:\dev\EasyDashboardScripts\EasyDashboard.cmake,ninja-Nightly-Release
@echo Running VTK Debug dashboard...
@cd "C:\dev\My Tests\VTK"
@ctest -S C:\dev\EasyDashboardScripts\EasyDashboard.cmake,ninja-Nightly-Debug
One nice thing about guaranteeing the right environment is set for running a script like this is being able to just use "git" and "ctest" in the script itself.
Obviously, you'll need to adjust path values according to tool installations on different machines.
For more details on setting up to run dashboards on Windows, see this page over on the CMake blog. (Also published on the Kitware blog.)
Good luck -- tweet me @DLRdave or ping me on G+ if you use this technique.