I am trying to build a Windows batch file which should do the following:
- Take the reference image (it should be the first image by taking into account the numeration
ima_0001.png,ima_0002.png...). - In the second step, the
FORstructure takes the images in the sequence (e.g.:ima_0001.png,imag_002.png, ...), calls a function to compare images from another batch file, and updates the reference image with the current image%defa%.
The script performs nearly well except for two major steps:
I can't set the reference or first file directly with
set "defa=ima_0001.png"
I tried in different ways:defa=ima_0001.png,defa=!ima_0001.png!, without success.
So finally I decided to leave theFORstructure selecting one which does not coincide with the first numbered (it takesima_0064.pngand notima_0001.png)
I thank somebody who can help me to set the first one whether manually or automatically.The worst part is that the second
FORstructure does not change the reference image with the lineset "defa=%%h".
For example, after the first cycleFOR,defashould change fromima_0001.pngtoima_0002.png, or fromima_0064.pngtoima_0065.png. However, when console runs,%%hchanges, butdefaalways shows the first image, (ima_0064.png). I also tried different ways without success, as well as settingsetlocalor not setting it.
I thank somebody who can give me notions to solve his issue.
The script is:
@echo off
setlocal enabledelayedexpansion
cd C:\Users\docs
set/a "th=870"
REM Set the first file or take one with FOR
::set "defa=ima_0001.png"
FOR %%m in (1,1,*.png) do set "defa=%%m"
REM BUCLE DE LLAMADA A LA FUNCIÓN Callme
FOR %%h in (*.png) DO (
Callme "%defa%" "%%h" %th%
set "defa=%%h"
)
pause