@echo off
if "%1%" =="" goto end
if "%2%" =="" goto end
set app=%1
rem set /p app=请输入APP名称:
rem set /p choose=字母C创建工程,字母B编译工程(C or B?):
rem if /I "%choose%"=="C" goto Create
rem if /I "%choose%"=="B" goto Build
rem goto end
if /I "%2%"=="1" goto Create
if /I "%2%"=="2" goto Build
:Create
mkdir %app%
mkdir "%app%/src"
mkdir "%app%/priv"
mkdir "%app%/include"
mkdir "%app%/ebin"
mkdir "%app%/doc"
echo {application, %app%, >> "%app%/ebin/%app%.app"
echo [{description, ""}, >> "%app%/ebin/%app%.app"
echo {vsn, ""}, >> "%app%/ebin/%app%.app"
echo {modules, [xxx]}, >> "%app%/ebin/%app%.app"
echo {registered, [xxx]}, >> "%app%/ebin/%app%.app"
echo {applications, [kernel, stdlib]}, >> "%app%/ebin/%app%.app"
echo {mod, {xxx, []}} ]}. >> "%app%/ebin/%app%.app"
echo 创建完毕!
goto end
:Build
for /r %app% %%a in (*.erl) do erlc %%a
rem erlc *.erl 总是报错 IO error
copy *.beam "%app%/ebin"
del *.beam
echo 编译完毕!
goto end
:end
pause
以上内容保存为 erlApp.bat. 使用格式如下(CMD):
1) erlApp.bat tr_server 1
创建 目录tr_server 以及子目录 src, ebin 等, 以及APP文件
2) erlApp.bat tr_server 2
编译 tr_server 下的所有Erl文件,并且复制到 ebin 目录下
主要就是这两个功能,嗯,只是方便我个人在WINDOWS 下玩erlang的。