[osgeo4w-dev] PATH ordering for OSGeo4W Shell

Mike Toews mwtoews at gmail.com
Tue Jul 17 00:19:16 PDT 2012


Hi all,

I have some commercial third-party software installed on my computer
that installed an older version of GDAL, including utilities, in it's
own directory structure. This software also appended it's paths to the
system PATH (done by the installer, not by my choice), so I could open
any cmd.exe and type "gdalinfo --version" to see "GDAL 1.7.0dev,
FWTools 2.4.4, released 2009/09/23".

However, from an OSGeo4W Shell, I'd rather be using the OSGeo4W
version of GDAL, but I'm not. Here's what I see from OSGeo4W Shell:
C:\>gdalinfo --version
GDAL 1.7.0dev, FWTools 2.4.4, released 2009/09/23

C:\>where gdalinfo
C:\GWV6\gdal\bin\gdalinfo.exe
C:\gnu\OSGeo4W\bin\gdalinfo.exe

C:\>c:\gnu\OSGeo4W\bin\gdalinfo.exe --version
GDAL 1.9.1, released 2012/05/15

C:\>PATH
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\GWV6\;C:\GWV6\gdal\bin;C:\Program
Files (x86)\Java\jre6\bin;C:\gnu\OSGeo4W\bin;C:\gnu\OSGeo4W\\apps\msys\bin;C:\gnu\OSGeo4W\\apps\Python27\Scripts

Why isn't gdalinfo.exe from OSGeo4W not used in preference over the
other one installed in C:\GWV6\gdal\bin? Here it looks like PATH has
been modified by OSGeo4W to append two paths.

With the MSYS shell distributed with OSGeo4W, things look better:

$ which gdalinfo
/osgeo4w/bin/gdalinfo.exe

$ gdalinfo --version
GDAL 1.9.1, released 2012/05/15

$ echo $PATH
.:/usr/local/bin:/bin:/mingw/bin:/osgeo4w/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/GWV6/:/c/GWV6/gdal/bin:/c/Program
Files (x86)/Java/jre6/bin:/bin:/osgeo4w/apps/Python27/Scripts

Why is the PATH variable set with MSYS inserting some paths at the
front, and appending others at the end? Should both shells be
inserting the paths at the beginning of the PATH environment?

-Mike


More information about the osgeo4w-dev mailing list