@echo off

cd/d "%~dp0"

set Src0=%~nx1

set Exp0=png
set Exp1=itp

set Opt=v6

set Dest0=%Src0%-ITP%Opt%

set Error0=%Src0%
if not exist "%Error0%" goto Error



for %%f in (%Src0%\*.%Exp0%) do (
if not exist "%Dest0%" mkdir "%Dest0%"
if not exist "itpcnv.exe" copy /b /y "_exe\itpcnv.exe">nul

"itpcnv.exe" -%Opt% "%%f" "%Dest0%\%%~nf.%Exp1%"

if exist "%Dest0%\%%~nf.%Exp1%" copy /b /y "_exe\CCPI_ITP.HDR" + "%Dest0%\%%~nf.%Exp1%" "_exe\Tmp0-%%~nf.%Exp1%">nul

if exist "_exe\Tmp0-%%~nf.%Exp1%" _exe\binmay.exe -s "564954410049545000484452EE030000" -r "01104150" -i "_exe\Tmp0-%%~nf.%Exp1%" -o "%Dest0%\%%~nf.%Exp1%">nul

if exist "_exe\Tmp0-%%~nf.%Exp1%" del /q "_exe\Tmp0-%%~nf.%Exp1%">nul
if exist "_exe\Tmp1-%%~nf.%Exp1%" del /q "_exe\Tmp1-%%~nf.%Exp1%">nul

echo.)



goto End
:Error
echo.
echo  [%Error0%] Not Found !
echo.
pause

:End
if exist "itpcnv.exe" del /q "itpcnv.exe">nul
if exist "%Dest0%" if not exist "%Dest0%\*.*" rd /q "%Dest0%">nul
if not exist "%Dest0%\*.%Exp1%" pause
rem pause
