Life’s a batch

31 03 2013

and then you discover bash…


Quick post, working towards automating the set up of a new development environment (more on that in a later post/s). First thing to do was remove ancient (and obsolete) environment variables. Second thing was to create a batch file to easily re-add the appropriate ones back in.

I need a path into the development home directory and my accompanying tools. This means either manually adding global environment variables or not. I opted for not seeing as I’m not too fond of global anything and I’ve seen the aftermath of forcing development across different machines using required global environment variables (it’s not pretty, not maintainable and most of all, not fun). So I’ve decided to go with setting up the development environment local to each console window (ie. machine). Doing this automatically requires a batch script for Windows’ cmd.

The batch script isn’t overly complicated (in fact it is very simple) because my current requirements aren’t overly complicated. But I expect this file to grow slowly as the environment matures.

By the way, if we are going to work with Windows’ cmd this website is quite a handy reference.

Okay, let’s do this thing 😛

I’ve named my file __setenv.bat and stuck it where the home directory should be. Note that sticking it where the home directory should be is important as it assumes that when creating the home variable using the %cd% value.

@echo off
title Dev-Console

set dev_home=%cd%
set tools_home=%dev_home%/tools
set mingw_home=%tools_home%/mingw

set Path=%Path%;%mingw_home%/bin

I’ve also made the console window’s title read “Dev-Console” just for fun 😛

Next time, Premake4 and Sublime Text 2! [hopefully, or not!]

“I was taught to stick with the right and work with the left”