mingw 多版本選擇 批處理

@echo off

set version=%
set gccdir=""
set gccversion=""
if defined version ( goto begin ) else ( goto showUse )

:begin
if "%version%" == "4.7" (
	set gccdir=gcc4.7.4
	set gccversion=4.7.4
	goto getVersion64
)
if "%version%" == "4.8" (
	set gccdir=gcc4.8.5
	set gccversion=4.8.5
	goto getVersion64
)
if "%version%" == "4.9" (
	set gccdir=gcc4.9.3
	set gccversion=4.9.3
	goto getVersion64
)
if "%version%" == "5.3" (
	set gccdir=gcc5.3
	set gccversion=5.3.0
	goto getVersion64
)
if "%version%" == "5.4" (
	set gccdir=gcc5.4.0
	set gccversion=5.4.0
	goto getVersion64
)
if "%version%" == "6.1" (
	set gccdir=gcc6.1.0
	set gccversion=6.1.0
	goto getVersion64
)
goto showUse


:showUse
echo "mingw version"
echo "versions: 4.7, 4.8, 4.9, 5.3, 5.4, 6.1"
goto choose


:choose
set /p version="input version:"
if defined version ( goto begin ) else ( goto getVersionDef )


:getVersion64
@title gcc %gccversion%(x64) build environment
@set PATH=%CD%\%gccdir%\mingw64\bin;%PATH%
cls
@call cmd
goto end


:getVersionDef
@title gcc 4.9.3(w32) build environment
@set PATH=%CD%\mingw\bin;%PATH%
cls
@call cmd
goto end


:end
相關文章
相關標籤/搜索