DOS batch SET and Opus SET commands in same button?

Creating a MSDOS batch function button to create an icon set.
Using montage.exe to create 2 icon sheets, large and small from individual images that have filename the same as internal name.
The separate images are iterated through and added to the XML, like so

The row and col values have not been filled in, because SET is not working as expected

set row=1
set col=1
set /A row=row+1

will not work if @externalonly has not been declared, but I cannot use @externalonly as I want to use some other DO commands to do the zipping afterwards.
Using @set col=1 cannot have arithmetic performed on it as far as I know.

Can @externalonly be turned on and off, if not is there another way ?

I would use scripting for this, if you want to automate it.

Trying to do anything complex with DOS-batch is asking for trouble. You'll save yourself time in the long run by doing it in JScript or VBScript (or almost anything other than DOS-batch).