@echo off
set __new=demo.db
if [%1]==[] goto makenew
set __new=%1
if [%~x1]==[.db] goto makenew
set __new=%1.db
:makenew
setlocal
if not exist %__new% goto init
dberase %__new%
if exist %__new% goto end
:init
dbinit %__new%
dbspawn -q -f dbeng12 -n newsdb %__new%
cd /d "%SQLANY12%\Scripts" 
dbisql -c "UID=DBA;PWD=sql;SERVERNAME=newsdb" -q mkdemo.sql 
dbstop -c "UID=DBA;PWD=sql;SERVERNAME=newsdb" -q
:end
endlocal
set __new=

