Only one line of this batch file will run
gdal_merge -o C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_merged.tif C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_nn10.tif C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_nn20.tif
gdal_merge -o C:\test\RasterMerge\p024r027\p024r027_7t19990828_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p024r027\p024r027_7t19990828_z16_nn10.tif C:\test\RasterMerge\p024r027\p024r027_7t19990828_z16_nn20.tif
gdal_merge -o C:\test\RasterMerge\p024r027\p023r026\p023r026_7t20001010_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p024r027\p023r026\p023r026_7t20001010_z16_nn10.tif C:\test\RasterMerge\p024r027\p023r026\p023r026_7t20001010_z16_nn20.tif
gdal_merge -o C:\test\RasterMerge\p024r027\p024r026\p024r026_7t20000729_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p024r027\p024r026\p024r026_7t20000729_z16_nn10.tif C:\test\RasterMerge\p024r027\p024r026\p024开发者_Go百科r026_7t20000729_z16_nn20.tif
gdal_merge -o C:\test\RasterMerge\p024r027\p023r026\p023r028\p023r028_7t20000519_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p024r027\p023r026\p023r028\p023r028_7t20000519_z16_nn10.tif
C:\test\RasterMerge\p024r027\p023r026\p023r028\p023r028_7t20000519_z16_nn20.tif
Note: I've removed the other 5 file names from each command to make it a bit more readable. I'm working on a Python tool that will construct a batch file for me but when I attempt to run this .bat all I get is the first command running successfully then returning to console. I'm running it in the FWTools shell. I've opened the batch file in a hex editor and searched for extra newlines and return characters but I don't see anything out of the ordinary so Python seems to be writing correctly.
is gdal_merge
a batch file itself?
In that case you need to enter call
before each line to prompt the batch file to return on exit from the called batch file, otherwise the exit call in the new batch file will be treated as a real exit so shall exit completely:
call gdal_merge -o C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_merged.tif C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_nn10.tif C:\test\RasterMerge\p023r027\p023r027_7t20010623_z16_nn20.tif
call gdal_merge -o C:\test\RasterMerge\p024r027\p024r027_7t19990828_z16_merged.tif -seperate -q -v C:\test\RasterMerge\p024r027\p024r027_7t19990828_z16_nn10.tif C:\test\RasterMerge\p024r027\p024r027_7t19990828_z16_nn20.tif
...
(it is also possible that python itself is run though a batch file, than the same applies, but possibly you can also use call python gdal_merge.py -o ...
)
If this is not a batch file then try using start /B
instead of call
as this will fork a new background task. If you need these to be called sequentially rather than in parallel then just use start /B /WAIT
.
精彩评论