@echo off

SET PNGOPFX=%~dp0

if NOT "%1"=="/r" GOTO pre2
SHIFT
SET DIRSW=/s

:pre2
if NOT "%1"=="/b" GOTO proc
SHIFT
SET POOSW=/b

:proc
dir /b %DIRSW% *.png | %PNGOPFX%xargs.exe -w --max-args=1 -P %NUMBER_OF_PROCESSORS% %PNGOPFX%pngoptone.bat %POOSW%

SET DIRSW=
SET POOSW=
SET PNGOPFX=
