@echo off
setlocal ENABLEDELAYEDEXPANSION
REM 设置MyEclipse目录
if not "%~1"=="" (
set myeclipsehome=%~1
goto check
)
echo Enter MyEclipse Install Path
set /p myeclipsehome=
:check
if %myeclipsehome:~-1%==\ set myeclipsehome=%myeclipsehome:~0,-1%
REM 进行判定
if not exist "%myeclipsehome%\myeclipse.ini" goto exception
if not exist "%myeclipsehome%\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info" goto exception
if not exist "%myeclipsehome%\plugins" goto exception
if not exist "%myeclipsehome%\features" goto exception

REM 拷贝插件至MyEclipse2014相关目录
copy features\* %myeclipsehome%\features
copy plugins\* %myeclipsehome%\plugins

REM 将引用写入配置文件
for /f "tokens=*" %%i in ('dir /b /a:-d .\plugins\*') do (
	echo %%~nxi
	set lib=%%~ni
	set lib=!lib:_0=,0!
	set lib=!lib:_1=,1!
	set lib=!lib:_2=,2!
	set lib=!lib:_3=,3!
	set lib=!lib:_4=,4!
	set lib=!lib:_5=,5!
	set lib=!lib:_6=,6!
	set lib=!lib:_7=,7!
	set lib=!lib:_8=,8!
	set lib=!lib:_9=,9!
	set lib=!lib!,plugins/%%~nxi,4,false
	echo !lib:\=/! >> "%myeclipsehome%\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info"
)

REM 启用中文
echo -Duser.language=zh >> "%myeclipsehome%\myeclipse.ini"
@pause
exit /b

:exception
echo 该目录不是MyEclipser2014的安装目录,请重新输入
pause