cls
echo off

:find
if exist "%PROGRAMFILES%\Microsoft Visual Studio*" goto :folder

:findX86
if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio*" goto :folderX86

:folder
for /d %%a in ( "%PROGRAMFILES%\Microsoft Visual Studio*" ) do (
	set "theFolder=%%~fa"
	
	if not exist "%theFolder%\VC*" goto :findX86
	
	for /d %%j in ("%theFolder%\VC*") do (
	
	    set "vcFolder=%%~fj"
		goto :folderVC
	)
	echo Voce nao possui uma instalacao do Visual Studio em sua maquina!
	goto :eof
)


:folderX86
for /d %%b in ( "%PROGRAMFILES(X86)%\Microsoft Visual Studio*" ) do (
	set "theX86Folder=%%~fb"
	 
	for /d %%i in ("%theX86Folder%\VC*") do (
	
	    set "vcFolder=%%~fi"
		goto :folderVC
	)
	echo Voce nao possui uma instalacao do Visual Studio em sua maquina!
	goto :eof
)

:folderVC
if not exist "%vcFolder%\include\GL\" md "%vcFolder%\include\GL\"

copy glut32.dll %SYSTEMROOT%\glut32.dll
copy glut32.dll %SYSTEMROOT%\System32\glut32.dll
copy glut32.lib "%vcFolder%\lib\glut32.lib
copy glut.h     "%vcFolder%\include\GL\glut.h
echo Instalacao realizada com sucesso!
goto :eof