@echo OFF

rem expand this file's path
	set FNAME=%0.bat
	if not "%OS%"=="Windows_NT" goto NoWinNT
	for %%A in (%FNAME%) do set NEW=%%~$PATH:A
	if not "%NEW%"=="" set FNAME=%NEW%
	set NEW=
	:NoWinNT

rem set PROGRAM FILES path
rem Note: Using the default value of %PROGRAMFILES% fails, because the
rem       if exist {name}\CON construct fails when {name} contains
rem       a space.
	set PROGRA=C:\PROGRA~1
	if exist %PROGRA%\CON goto FINDVRT
echo  %FNAME% could not find program files, unable to continue.
	goto QUIT
	:FoundPrograms

:FINDVRT
rem find VIMRUNTIME path (based on PROGRAMFILES)
	set VRT=%PROGRA%\vim\vimFALSE
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim72
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim71
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim70
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim64
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim63
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim62
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim61
	if exist %VRT%\CON goto RUNCREAM
	set VRT=%PROGRA%\vim\vim60
	if exist %VRT%\CON goto RUNCREAM
echo  %FNAME% could not find a Vim installation, unable to continue.
	goto QUIT

:RUNCREAM
	"%VRT%\gvim" --servername "CREAM" -u "%VRT%\cream\creamrc" -U NONE "%*"
	goto QUIT

:QUIT
	set VRT=
	set PROGRA=
	set FNAME=

:END

