@echo off
setlocal enabledelayedexpansion enableextensions
rem 0 = rotate right the first time, then alternate
set left=0

IF NOT EXIST pages mkdir pages
for %%i in (*.tif) DO (
IF !left! equ 1 ( 
convert %%i -rotate -90 pages/%%~ni.png
set left=0
) else (
convert %%i -rotate 90 pages/%%~ni.png
set left=1
)
)


endlocal