[FWTools] FWTools on USB

Matt Wilkie matt.wilkie at gov.yk.ca
Fri Feb 16 18:37:17 EST 2007


Mateusz Loskot wrote:
> David Fawcett wrote:
>> Has anyone come up with an example setfw.bat and openev.bat for use on a
>> USB drive where the drive letter may change? 
> 
> May be %CD% environment will help.
> 
> SET FWTOOLS_DIR=%CD%

If this is in a batch file better to use this instead. It allows the 
batch file to be run from somwhere else, by rooting fwtools_dir to the 
same directory that the script is in:

    SET FWTOOLS_DIR=%~dp0

example:

   C:> f:\usb-apps\fwtools\setfw_portable.cmd


Attached update is to allow for this usage.

-- 
matt wilkie
--------------------------------------------
Geographic Information,
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/
--------------------------------------------
-------------- next part --------------
@echo off
if not %cmdextversion% GEQ 2 goto :WrongCmd

:Main
	cls &	echo.
	rem Root fwtools home dir to the same directory this script exists in
	set FWTOOLS_DIR=%~dp0
	echo FWTools home is %FWTOOLS_DIR% & echo.
	
	rem Add fwtools bin directory to path and make sure gdal is there.
	for %%a in (gdalinfo.exe) do (
		if [%%~dp$PATH:a]==[] path=%FWTOOLS_DIR%bin;%PATH%
		) 
	gdalinfo --version || goto :NotFound

	rem List available commands
	echo. & echo Available exe commands are: & echo.
	dir /d %FWTOOLS_DIR%bin\*.exe |find ".exe"
	echo. & echo Available python commands are: & echo.
	dir /d %FWTOOLS_DIR%bin\*.py |find ".py"

	goto :EOF

:WrongCmd
	echo.
	echo	Sorry, this script requires CMD.exe with extension
	echo	version 2 or above (Windows 2000 or later)
	echo.
	echo	Yours appears to be: %CMDEXTVERSION%
	echo.
	goto :EOF

:NotFound
	echo.
	echo	Sorry, I can't find GDAL Utilities
	echo.


More information about the FWTools mailing list