[gdal-dev] how to batch rgb2pct

Matt Wilkie matt.wilkie at gov.yk.ca
Thu Oct 8 13:40:07 EDT 2009


Hi Micheal,

rgb2pct is a batch file, so when used inside another batch it must be 
"called" in order for control to return to the initiator:

   call rgb2pct v:\historic_topos\rects\w\arnold-pond-w.tif 
v:\historic_topos\8bits\w\arnold-pond-w.tif
   call rgb2pct v:\historic_topos\rects\w\attean-w.tif 
v:\historic_topos\8bits\w\attean-w.tif
   call rgb2pct v:\historic_topos\rects\w\baker-lake-w.tif 
v:\historic_topos\8bits\w\baker-lake-w.tif
 
If I may extend your script a little:

   @echo off
   for %%f in (arnold-pond-w.tif, attean-w.tif, baker-lake-w.tif) do (
      call rgb2pct v:\historic_topos\rects\w\%%f 
v:\historic_topos\8bits\w\%%f
       )

or interactively from the command line:

  pushd v:\historic_topos\rects\w\
  for %f in (*.tif) do rgb2pct %f ..\..\8bits\w\%f
  popd


More info at http://ss64.com/nt/call.html

cheers,

matt wilkie
--------------------------------------------
Geomatics Analyst
Information Management and Technology
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
http://environmentyukon.gov.yk.ca/geomatics/
-------------------------------------------- 



Smith, Michael wrote:
> I have a .bat file which I'm trying to run, here are a few lines:
>  
> rgb2pct v:\historic_topos\rects\w\arnold-pond-w.tif 
> v:\historic_topos\8bits\w\arnold-pond-w.tif
> rgb2pct v:\historic_topos\rects\w\attean-w.tif 
> v:\historic_topos\8bits\w\attean-w.tif
> rgb2pct v:\historic_topos\rects\w\baker-lake-w.tif 
> v:\historic_topos\8bits\w\baker-lake-w.tif
>  
> When I run the .bat it runs the first line and then just stops, 
> returning to the windows command prompt.  I can copy/paste other lines 
> into the command prompt and they work fine.  How do I get it to 
> process the next line(s)?
>
> **********
> Michael Smith
> State GIS Manager
> Maine Office of GIS
>
>  


More information about the gdal-dev mailing list