@echo off
rem
rem	This command file repairs IDA database.
rem
rem	Usually it will be run from IDA automatically.
rem	To run it manually:
rem		- run IDA and exit with "Don't pack database"
rem		- run this command file on the *.ID0 file
rem		  for example: IDACHECK MYBASE.ID0
rem		- if you don't want to keep the database in the
rem		  unpacked form, run IDA and exit with "Pack..." 
rem
cls
if %1. == . goto Usage
btvx -c %1
if errorlevel 1 goto Error
btvx %1 idachk.tmp
if errorlevel 1 goto Error
if not exist idachk.tmp goto Error
del %1
copy idachk.tmp %1
del idachk.tmp
if errorlevel 1 goto Ex
goto End
:Usage
echo .
echo .  Usage: idacheck filename
echo .         where filename is *.id0 file
echo .
goto Ex
:Error
echo .
echo .	Error during validation
echo .
:Ex
pause
:End
