No problem, tough I'm not sure if this a is productive way to do things. I mean I would need to know awfully lot about your actual needs to make it workable in robust way that's actually useful for you:
Stick this in jooPrintMyPasses.mel
// author : Janne Ojala
// license: Creative Commons Attribution
proc string jooPaddInt(int $num,int $pad){
$ceil=pow(10,$pad);
$new=$num+$ceil;
if ($ceil>$num)
return substring ((string)$new,2,$pad+1);
return $num;
}
global proc jooPrintMyPasses(){
$passes = `listConnections -type "renderPass"
(editRenderLayerGlobals("-q","-currentRenderLayer")+ ".renderPass")`;
$frame = jooPaddInt(currentTime("-q"),
getAttr("defaultRenderGlobals.extensionPadding"));
for ($pass in $passes)
print (renderSettings("-fp","-cts","RenderPass="+$pass,
"-gin", $frame, "-lut"));
}
then you can call:
jooPrintMyPasses()
in your pre or post render frame. This is a example so you will need to change it to fit your purpose tough but that's ok. I'm licensing it under creative commons attribution license.
However i must say that why don't you actually listen to your disk events instead? That would probably be much more productive as it would account for errors maya may make. Or i would think of changing the mel files that actually call batch render.
PS: ther is actually a function allready done in maya for this but i did thsi just as a academic exercice for myself.