anchor.diff:  	call:echostd " Optimized %1:		%opt%"
   	if "%nopt%" neq "0" call:echostd " Not optimized %1:	%nopt%"
   	if "%tterr%" neq "0" call:echostd " Skipped %1:		%tterr%"
  -	call:echostd " Total %1:  		%%change%1%% KB, %%perc%1%%%%%%"
  +	set "steping=0"
  +	call set "stepcur=%%step%1%%"
  +	for %%a in (byte KB MB GB TB) do (
  +		if !steping! equ !stepcur! call:echostd " Total %1:  		%%change%1%% %%a, %%perc%1%%%%%%"
  +		set /a "steping+=1"
  +	)
   	call:echostd
   )
   exit /b
  
positive.code: )
  1>nul 2>&1 del /f /q "%logfile%*" "%countJPG%" "%countPNG%*" "%filelist%*" "%filelisterr%*" "%iclock%"
  if exist "%tmppath%" 1>nul 2>&1 rd /s /q "%tmppath%"
  exit /b
  
  :totalmsg
  
negative.code: exit /b
  
  :printfileinfo
  set "fn=%~nx1                                        "
  if "%~4" equ "0" (
  	echo.^|%fn:~,30%^|    Skip - The image is already optimized    ^|
  	exit /b
  )
  set "origsize=%2"
  call:division origsize 1024 100
  set "origsize=          !origsize!"
  set "optsize=%3"
  call:division optsize 1024 100
  set "optsize=          !optsize!"
  set "change=%4"
  call:division change 1024 100
  set "change=          !change!"
  set "float=%3"
  call:division float 1024 100
  set "percent=          %5%%"
  echo.^|%fn:~,30%^|%origsize:~-11%^|%optsize:~-11%^|%change:~-10%^|%percent:~-10%^|
  exit /b
  
  :printfileerr
  set "fn=%~nx1                                        "
  set "errmsg=%~2"
  call:centerstring errmsg 45
  1>&2 echo.^|%fn:~,30%^|%errmsg%^|
  exit /b
  
  :centerstring StrVar Length
  if "%~1" equ "" exit /b
  if not defined %~1 exit /b
  set "xstringlen=0"
  call:strlen %~1 xstringlen
  set "xstr=!%~1!"
  if %xstringlen% geq %~2 (
  	call set "%~1=!xstr:~,%~2!"
  	exit /b
  )
  set /a "xstraddlen=(%~2-%xstringlen%)/2"
  set "xstradd="
  for /l %%x in (1,1,%xstraddlen%) do set "xstradd=!xstradd! "
  set "%~1=%xstradd%!%~1!%xstradd%"
  set /a "xstraddlen=%xstringlen%+%xstraddlen%*2"
  if %xstraddlen% lss %~2 set "%~1= !%~1!"
  exit /b
  
  ::original: http://forum.script-coding.com/viewtopic.php?pid=71000#p71000
  :strlen  StrVar  RtnVar  --  be sure to check if the returned errorlevel is 0
  setlocal
  set /a "}=0"
  if "%~1" neq "" if defined %~1 (
          for %%# in (4096 2048 1024 512 256 128 64 32 16) do (
              if "!%~1:~%%#,1!" neq "" set "%~1=!%~1:~%%#!" & set /a "}+=%%#"
          )
          set "%~1=!%~1!0FEDCBA9876543211" & set /a "}+=0x!%~1:~32,1!!%~1:~16,1!"
      )
  )
  endlocal & set /a "%~2=%}%"
  exit /b
  
  :echostd
  