FWToolsOnUSB: setfw_portable.cmd

File setfw_portable.cmd, 1.5 kB (added by maphew, 8 months ago)
Line 
1 @echo off
2 :: A simple script to allow one to use FWTools for Windows from a USB device
3 :: without installing anything on the host.
4 ::
5 :: Save with .cmd extension to ensure command.com is not used  (a hold over
6 :: from Win9x). The script will only work on Windows 2000 and newer.
7 ::
8 :: Initial version 2007 Feb 16, Matt Wilkie (maphew@gmail.com)  [mhw]
9 :: 2007-OCt-25 [mhw] added missing call for setfwenv.bat, (thanks to Farley Klotz)
10
11 if not %cmdextversion% GEQ 2 goto :WrongCmd
12
13 :Main
14         cls & echo.
15         rem Root fwtools home dir to the same directory this script exists in
16         set FWTOOLS_DIR=%~dp0
17         rem Rmove trailing backslash
18         set FWTOOLS_DIR=%FWTOOLS_DIR:~0,-1%
19         echo FWTools home is %FWTOOLS_DIR% & echo.
20
21         rem Add fwtools bin directory to path and make sure gdal is there.
22         for %%a in (gdalinfo.exe) do (
23                 if [%%~dp$PATH:a]==[] path=%FWTOOLS_DIR%\bin;%PATH%
24                 )
25         gdalinfo --version || goto :NotFound
26        
27         rem Configure environment for python modules, proj lib data, drivers, etc.
28         call %FWTOOLS_DIR%\bin\setfwenv.bat
29        
30         rem List available commands
31         echo. & echo Available exe commands are: & echo.
32         dir /d %FWTOOLS_DIR%\bin\*.exe |find ".exe"
33         echo. & echo Available python commands are: & echo.
34         dir /d %FWTOOLS_DIR%\bin\*.py |find ".py"
35
36         goto :EOF
37
38 :WrongCmd
39         echo.
40         echo Sorry, this script requires CMD.exe with extension
41         echo version 2 or above (Windows 2000 or later)
42         echo.
43         echo Yours appears to be: %CMDEXTVERSION%
44         echo.
45         goto :EOF
46
47 :NotFound
48         echo.
49         echo Sorry, I can't find GDAL Utilities
50         echo.