Run a maintenance plan: Example batch file

In this example batch file, which runs a maintenance plan called "db", a message reflecting the return code of the maintenance plan is displayed on the command line.

echo off


if not defined errorlevel goto end


"C:\Program Files\ReadSoft\INVOICES\Bin\eimngr.exe" /m db


if errorlevel 2 goto answer2


if errorlevel 1 goto answer1


:answer0


echo Maintenance plan executed without errors.


pause


goto end


:answer1


echo Maintenance plan executed with minor errors. Please check the log file for details.


pause


goto end


:answer2


echo Maintenance plan could not be executed. Please check the log file for details.


pause


:end


echo on