Bug report #5345
Problems with PATH-Variables in msys.bat and OSGeo4W
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | - | ||
Affected QGIS version: | 1.7.4 | Regression?: | No |
Operating System: | Windows | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | up/downstream |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 15045 |
Description
Under Windows-OS the batch files "msys.bat" and "OSGeo4W.bat" experience problems when path-variables to executables called within the batch file contain whitespace like "C:\\Program Files\\Quantum Gis Wroclaw" - which is the case in all Windows installations of QGis. Execution of batch file terminates with "C:\\Program" could not be found...
Might have s.th. to do with coding the path to the executables in a variable (not hardcoded).
Execution of batch file msys.bat worked without problems in 1.7.3
Execution of batch file for calling Grass works without problems in 1.7.4
History
#1 Updated by Paolo Cavallini over 12 years ago
- Target version changed from Version 1.7.4 to Version 1.8.0
#2 Updated by Jürgen Fischer over 12 years ago
- Resolution set to upstream
#3 Updated by Jürgen Fischer over 12 years ago
- Subject changed from Problems with PATH-Variables in mysy.bat and OSGeo4W (Windows) to Problems with PATH-Variables in msys.bat and OSGeo4W
#4 Updated by Paolo Cavallini about 12 years ago
- Target version changed from Version 1.8.0 to Version 2.0.0
#5 Updated by Andre Joost about 12 years ago
After testing a bit around with quotation marks, I made the following changes to osgeo4w.bat:
@echo off rem Root OSGEO4W home dir to the same directory this script exists in set OSGEO4W_ROOT=%~dp0 rem Convert double backslashes to single set OSGEO4W_ROOT=%OSGEO4W_ROOT:\\\\=\\% echo. & echo OSGEO4W home is %OSGEO4W_ROOT% & echo. set _path=%OSGEO4W_ROOT%bin call "%OSGEO4W_ROOT%bin\\addpath.bat" _path set _path= rem Add application-specific environment settings for %%f in ("%OSGEO4W_ROOT%\\etc\\ini\\*.bat") do call "%%f" rem List available o4w programs rem but only if osgeo4w called without parameters rem if [%1]==[] call o-help @echo on @if [%1]==[] (cmd.exe /k o-help) else (cmd /c "%*")
and for o-help.bat:
@echo off :: Osgeo4w Quick Help -- report available executables in o4w bin directory :: :: 2012-02(Feb)-06, Matt Wilkie <[email protected]> :: License: Open source MIT, http://www.opensource.org/licenses/mit-license :: setlocal enabledelayedexpansion :Main echo. -={ OSGeo4W Shell Commands }=- if ["%OSGEO4W_ROOT%"]==[] goto :NoEnv rem Generate executables list pushd %OSGEO4W_ROOT%\\bin echo. > "%temp%\\o-help-list.txt" dir /d *.exe |find ".exe" >>"%temp%\\o-help-list.txt" echo. >>"%temp%\\o-help-list.txt" dir /d *.bat |find ".bat" >>"%temp%\\o-help-list.txt" popd rem Strip extensions and report just names rem c.f. http://ss64.com/nt/syntax-replace.html for /f "usebackq delims=?" %%g in ("%temp%\\o-help-list.txt") do ( set _s=%%g set _s=!_s:.exe=! set _s=!_s:.bat=! echo. !_s! ) echo. del "%temp%\\o-help-list.txt" rem Report gdal version, if present for %%g in (gdalinfo.exe) do if not ["%%~dp$PATH:g"]==[] gdalinfo --version goto :EOF :NoEnv echo ERROR: OSGEO4W_ROOT is not set echo.
The previous error does not come up, but gdalinfo crashes in the end.
#6 Updated by Andy Harfoot about 12 years ago
I have independently applied the same corrections to osgeo4w.bat and o-help.bat proposed by Andre Joost and can confirm that these modifications correct the errors for both the standalone install (1.8.0.1) and the OSGeo4W package based install (GDAL 1.9.1-2) on Win7.
I have raised a ticket duplicating most of this on the OSGeo4W trac (http://trac.osgeo.org/osgeo4w/ticket/315)
#7 Updated by Giovanni Manghi about 11 years ago
- Resolution changed from upstream to up/downstream
- Status changed from Open to Closed
The ticket filed upstream has been fixed, I guess this can be closed.