2

When I run following command in cmd prompt it works:

for /R %f in (*.shp) do ogr2ogr -nln merge -update -append merge.shp %f 

but when I run it from .bat file it does not work. Saying -nln was unexpected.

Is there anyway I could run this from .bat file.

4

1 回答 1

3

The % character has a special meaning for command line parameters and FOR parameters.

To treat a percent as a regular character, double it: %%

When you execute it from a batch file, you should write it like this :

@echo on
for /R %%f in (*.shp) do ogr2ogr -nln merge -update -append merge.shp %%f 
pause

See this for more info : http://ss64.com/nt/syntax-esc.html

于 2016-05-08T02:53:47.807 回答