This is untested - it displays the command to the screen only.
It is right then you can thank Squashman for supplying the meat of the batch file on the 3rd post in this thread.
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /b /on c*.tif ') do (
set "year=%%~na"
set "daynum=!year:~5,3!"
set "year=!year:~1,4!"
call :OrdinalToDate !year! !daynum! yy month dd
echo %%a matches to !yy!-!month!-!dd!
if !Month!==01 set Month=JAN
if !Month!==02 set Month=FEB
if !Month!==03 set Month=MAR
if !Month!==04 set Month=APR
if !Month!==05 set Month=MAY
if !Month!==06 set Month=JUN
if !Month!==07 set Month=JUL
if !Month!==08 set Month=AUG
if !Month!==09 set Month=SEP
if !Month!==10 set Month=OCT
if !Month!==11 set Month=NOV
if !Month!==12 set Month=DEC
echo gdal_calculate --outfile=D:\path\to\file\difference.tif --calc="((image1-image2)/(image1+image2))" --image2=D:\path\to\subtrahend\sample_file_!Month!.tif image1=D:\path\to\minuend\%%a --extent=INTERSECT
pause
)
echo done
pause
goto :EOF
@echo off&setlocal
call :OrdinalToDate %1 %2 yy mm dd
echo/%yy%-%mm%-%dd%
goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:OrdinalToDate %year% %doy% yy mm dd
::
:: By: Ritchie Lawrence, 2002-09-29. Version 1.0
::
:: Func: Returns a calendar date from an ISO 8601 Ordinal date.
:: For NT4/2K/XP.
::
:: Args: %1 year component to be converted, 4 digits (by val)
:: %2 day of year component to be converted, 001 to 366 (by val)
:: %3 var to receive year, 4 digits (by ref)
:: %4 var to receive month, 2 digits, 01 to 31 (by ref)
:: %5 var to receive day of month, 01 to 31 (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS
for /f "tokens=1-2" %%a in ('echo/%1 %2') do set /a yy=%%a,o=1%%b%%1000
set /a z=14-1,z/=12,y=yy+4800-z,m=1+12*z-3,j=153*m+2
set /a j=j/5+1+y*365+y/4-y/100+y/400-2432046,j+=o-1
set /a a=j+2432045,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
endlocal&set %3=%yy%&set %4=%mm%&set %5=%dd%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::