Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#32 closed defect (fixed)

the template for batch files should have a quoted path, else CALL fails

Reported by: maphew Owned by: osgeo4w-dev@…
Priority: major Component: Installer
Version: Keywords:
Cc:

Description

If there is a space in OSGEO4W_ROOT the call will fail. The fix is to quote %%f. Using current qgis.bat.tmpl as an example, the corrected template is:

@echo off

SET OSGEO4W_ROOT=@osgeo4w@
PATH %OSGEO4W%\bin;%PATH%
for %%f in ("%OSGEO4W_ROOT%"\etc\ini\*.bat) do call "%%f"
start /B %OSGEO4W_ROOT%\bin\qgis.exe %*

Note: for some reason Windows is smart about quotes when setting PATH, so they are not needed there. Likewise the embedded quote within the FOR ... IN does not cause a problem.

Change History (3)

comment:1 Changed 13 years ago by maphew

just noticed the PATH statement is missing root (check the qgis package) make that:

@echo off

SET OSGEO4W_ROOT=@osgeo4w@
PATH %OSGEO4W_ROOT%\bin;%PATH%
for %%f in ("%OSGEO4W_ROOT%"\etc\ini\*.bat) do call "%%f"
start /B %OSGEO4W_ROOT%\bin\qgis.exe %*

comment:2 Changed 13 years ago by maphew

Resolution: fixed
Status: newclosed

I've added a template to the Packaging Instruction page for launching an application with the standard osgeo4w environment settings here

comment:3 Changed 13 years ago by maphew

better solution (also documented in packaging instructions):

@echo off
SET OSGEO4W_ROOT=@osgeo4w@
call %OSGEO4W_ROOT%\bin\o4w_env.bat
start /B %OSGEO4W_ROOT%\bin\foo.exe %*
@echo on
Note: See TracTickets for help on using tickets.