How do I run mkgmap on a batch of files in Windows?

I’d like to run mkgmap on a set of 20 MP files.

Windows will run

for %%i in (*.mp) do java.exe -Xmx1280M -enableassertions -jar “c:\program files\mkgmap\mkgmap.jar” --route --net --description=“SUT-2D” --mapname=12345678 %%i

but, as it stands, this code will only overwrite 12345678.img with every file in the set of *.mp. Is there a way to get mkgmap to access the 8 digit MapID in the MP file, or to get Windows to concatenate and increment the IMG name?

Thanks in advance.

How about run Mkgmap without the for loop:

java.exe -Xmx1280M -enableassertions -jar “c:\program files\mkgmap\mkgmap.jar” --route --net --description=“SUT-2D” --mapname=12345678 *.mp

Because that’s what is working for me under linux.

I can see how that works for creating the 6324000.TDB and IMG, but how does that generate multiple map names? It looks to me like that would overwrite 12345678.IMG with every MP in *.MP. In my case 20 calls end with a single 12345678.IMG, the last compiled file.

Not sure if it’s the same. But when I process my downloaded raw data from the open streetmaps server I use this cmd file, which i call like

maak.cmd Nederland

It makes files named the same as the input files, but with other extention. It contains:

FOR %%X IN (*.osm) DO (call :s_mm %%X %1%)
GOTO :eof

:s_mm
SET _alles=%1%
SET _land=%2%
SET _kaart=%_alles:~0,8%
SET _gridd=%_alles:~4,4%
echo %_land% %_alles% %_kaart% %_gridd%
java -jar c:\apps\geocaching\mkgmap\mkgmap.jar --mapname=%_kaart% --description=“%_land% grid %_gridd%” %_alles%
GOTO :eof

It will process all files ending on .osm and I set some parameters:
First I set a parameter to the full filename:
SET _alles=%1%

The I set a parameter to the parameter passed to the cmd file for naming the country:
SET _land=%2%

Then I set a parameter for the mapname, which the first 8 characters from the name, which is an 8 digit number in my case:
SET _kaart=%_alles:~0,8%

Finally I set a parameter to a grid coordinate. That’s just the way I named my data.
SET _gridd=%_alles:~4,4%

Hope this helps…

Thanks, triggerfish. It helps a lot, although there is more Windows Command Language here than I ever hoped to learn. If I read this right, your OSM filename is in a format like 12345678.OSM where 5678 is parsed to the grid and 12345678 is parsed to the mapname. Is the _land parameter Nederland?

Yes, that is correct. I used the filename’s first four digits to define a country then two sets “coordinates” on a map “chess board”. So i got several files which together defined an area. The only parameter you would probably need would be the _kaart one, which reflects the name part of the filename.

Best regards, Peter