@echo off :: DBBACKUP.CMD :: Written by J.Mercier, Boeing - Autometric :: Please send enhancements or changes to justin.f.mercier@boeing.com :: so that they be rolled into the support/software archive!!!!! setlocal ENABLEEXTENSIONS :: Debugging options. :: Set Debug to 1 to enable tracing :: set ECHO to ON to enable command echo :: leave either blank to disable set DEBUG=0 set ECHO=off @if defined ECHO echo %ECHO% if {%DEBUG%}=={1} (set TRACE=echo) else (set TRACE=rem) :: Parse script name and path from CLA set SCRIPTNAME=%~n0 set SCRIPTPATH=%~dp0 pushd %SCRIPTPATH% color 17 set LIBFILE=backuplib.cmd set INIFILE=backupini.ini call %LIBFILE% :setDateStamp call %LIBFILE% :readINI if not defined DBKEY ( if {%1} EQU {} ( echo No sa password specified, please specify in INI file or on the command line. echo exitting.... pause exit 1 ) ELSE ( set DBKEY=%1 ) ) ::~~~~ Vars ~~~~ :: Specify drive to append backup directory to call :main endlocal & goto :EOF ::~~~~ Main ~~~~ :main ::~~~~ Call Actual CMD Script to run and log all output ~~~~ call %LIBFILE% :runbackup if {%RET%} EQU {1} ( echo. echo There was an error backing up the database. echo Please review the log file. The backup utility will exit. pause rem exit 1 ) ::~~~~ Report output to user and roll into the log ~~~~ call %LIBFILE% :logoutput ::~~~~ Update %LATEST% file echo %DUMPFILE% > %DBNAME%.latest.txt echo %MDUMPFILE% > master.latest.txt pause goto :EOF :: We should not have gotten this far as we should have exited through a branch by this point echo reached end of script? pause endlocal & exit 1