[FWTools] Schedule ogr2ogr within batch file

Steve White archmapper at googlemail.com
Thu Sep 11 03:27:02 EDT 2008


I have a VRT file that I use to dump all data from a SQL Server DB to SHP.
This works perfectly.

 

Now I want to run this process in a batch file on a schedule using Task
Scheduler in Windows 2003 Server.

 

I'm no batch expert and have done a bit of reading but can't get it to work.

 

Here's what I have so far:

 

@echo off

cd "C:\Program Files\FWTools2.2.3\bin"

ogr2ogr -f "ESRI Shapefile" -sql "select ItemID, ItemName, Latitude,
Longitude, CategoryName, CAST(IDesc AS character(255)) AS 'IDesc', CatId
from OA" "C:\Output - SHP files\OA.shp" "C:\VRT files\OAData.vrt" -a_srs
epsg:4326

 

When I run it nothing happens, but if I open a CMD prompt go directly to
"C:\Program Files\FWTools2.2.3\bin" and run the following it works:

ogr2ogr -f "ESRI Shapefile" -sql "select ItemID, ItemName, Latitude,
Longitude, CategoryName, CAST(IDesc AS character(255)) AS 'IDesc', CatId
from OA" "C:\Output - SHP files\OA.shp" "C:\VRT files\OAData.vrt" -a_srs
epsg:4326

 

Anyone help me out with this?

 

Cheers,

 

Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20080911/8b989e31/attachment.html


More information about the FWTools mailing list