@echo off

if "%1" == "" goto :usage
if "%2" == "" goto :usage
if "%3" == "" goto :usage

@echo Delete the existing export of %3...
if exist f%3 rd /s /q f%3

@echo Export application %3...
set CLASSPATH=%CLASSPATH%;classes\classes12.jar;classes\apex.jar
java oracle.apex.APEXExport -db loordv01:1521:dev10g -user %1 -password %2 -applicationid %3

@echo Split application %3...
java oracle.apex.APEXExportSplitter f%3.sql
@echo Export of application %3 into directory f%3 complete...

goto :done

:usage

echo exp_apex db_username db_password applicationid

:done