[postgis-users] loading sql files using batch commands - psql

Mark Volz MarkVolz at co.lyon.mn.us
Tue Nov 20 11:01:30 PST 2012


Hello,

I am trying to create a batch program that will update postgis from a directory of shapefiles.  I came across http://suite.opengeo.org/opengeo-docs/dataadmin/pgGettingStarted/shp2pgsql.html, which uses psql to load data into postgis.  The psql command appears to prompt for a password, which would be fine if I was manually running the batch file.  However, I want to set up a scheduled task in windows so that my data gets updated on automatic intervals.

Is there a way to store a password in a batch file such as " for %%f in (*.sql) do psql -p 5432 -w -U postgres --password mypassword --dbname postgis20 -f %%f?
If not is there a way to trick a windows batch file to send the password to psql?

Thanks for any help

Mark Volz
GIS Specialist



More information about the postgis-users mailing list