Running MsBuild on 32-bit and 64-bit Windows

Here's a simple script I use to allow me to invoke an MsBuild project from the command line. It does some simple checking for whether the machine is running 32-bit or 64-bit and adjusts the path to msbuild.exe accordingly, since, of course, msbuild is deployed in different folders in each flavour of the OS.

@echo off

rem Assume x86 to start with
SET MsBuildPath="%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"

rem Is this a 64 bit machine?
IF EXIST "%Programfiles(x86)%" SET MsBuildPath="%windir%\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"

if "%1" == "" goto DefaultTarget
goto SpecificTarget

%MsBuildPath% Test.proj /verbosity:detailed
goto End

%MsBuildPath% Test.proj /t:%*