# Why won't the QGIS Lisboa MSYS and OSGeo4W shortcuts launch?

I'm trying to deploy Quantum GIS Lisboa to 64bit windows 7 machines the installation works fine but the shortcuts wont run

With an error Windows cannot find "C:\Program"

This also happens on XP sp3 machines

The version I'm installing is QGIS-OSGeo4W-1.8.0-1-Setup.exe

ANy help would be really appreciated

Thanks

-
Could you post the full error? – R.K. Sep 18 '12 at 9:04
That is the error on a win7 machine launch launching the MSYS shortcut - "Windows cannot find 'C:\Program'. Make sure you typed the name corectly,and then try again." – Richard Timms Sep 18 '12 at 9:29
running OSGeo4W shortcut launches a batch file:OSGEO4W home is C:\Program Files\Quantum GIS Lisboa\ 'C:\Program' is not recognized as an internal or external command, operable program or batch file. 'C:\Program' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. 'GIS' is not recognized as an internal or external command, operable program or batch file. 'o-help' is not recognized as an internal or external command, operable program or batch file. – Richard Timms Sep 18 '12 at 9:32
that's not on a 64 bit machine clearly. I was just ruling out the 32/64 bit possible issue – Richard Timms Sep 18 '12 at 9:33
Please check my answer :) – R.K. Sep 18 '12 at 10:00

## 4 Answers

Can you check o4w_env.bat in your bin folder if it reads:

@echo off
echo.
rem Make parent of this script location our current directory,
rem converting UNC path to drive letter if needed
pushd %~dp0
cd ..

set OSGEO4W_ROOT=%cd%
PATH=%OSGEO4W_ROOT%\bin;%PATH%
for %%f in ("%OSGEO4W_ROOT%"\etc\ini\*.bat) do call "%%f"
echo OSGEO4W home is %OSGEO4W_ROOT%
popd


I think the " " around %OSGEO\$W_ROOT% are important. Unless the variable is broken. Running the bat should return

OSGEO4W home is C:\Program Files (x86)\Quantum GIS Lisboa

Manually editing the bat file, this works also:

set OSGEO4W_ROOT=C:\Program Files (x86)\Quantum GIS Lisboa


on Windows 7. If that works, run the bat files in etc\ini one by one to see which one makes trouble.

-
The bat file looks exactly as you've posted but when it runs the command prompt appears then just disappears without producing any output. Even when I did as you suggested and changed the OSGEO4W_ROOT manually – Richard Timms Sep 18 '12 at 13:01
Thats another thing: On Windows 7, navigate to the Lisboa folder, and right-click on the bin path -> open Command Window here. Then you can start the bat and read the output. For Windows XP, you have to run start/Execute -> cmd and navigate to the folder with cd.. – AndreJ Sep 18 '12 at 13:07
Ahh yes, so without changing it it returns: _path=C:\Program Files\Quantum GIS Lisboa\apps\Python27\Scripts OSGEO4W home is C:\Program Files\Quantum GIS Lisboa – Richard Timms Sep 18 '12 at 13:13
running the OSGeo4W.bat returns :'C:\Program' is not recognized as an internal or external command, operable program or batch file. 'C:\Program' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. 'GIS' is not recognized as an internal or external command, operable program or batch file. -={ OSGeo4W Shell Commands }=- Files\Quantum was unexpected at this time. – Richard Timms Sep 18 '12 at 13:17
Ok, found the error in the batch files. See the bug report open for this issue: hub.qgis.org/issues/5345 – AndreJ Sep 19 '12 at 6:39

UPDATE:

I thinks it's fixed now. You might want to try the latest OSGeo4W installer and test it again. I just tried it on my computer and it installed QGIS on C:\OSGeo4W hereby avoiding the problem with spaces. Good luck :)

You'll have to edit batch files and convert the paths with spaces to their short names. Particularly qgis.bat

 @echo off

SET OSGEO4W_ROOT=C:\Program Files\Quantum GIS Lisboa
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\apps\grass\grass-6.4.2\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin;%OSGEO4W_ROOT%\apps\grass\grass-6.4.2\lib
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\apps\qgis\bin\qgis.exe %*


The following line

SET OSGEO4W_ROOT=C:\Program Files\Quantum GIS Lisboa


should be

SET OSGEO4W_ROOT=C:\PROGRA~1\QUANTU~1


On 64-bit Windows, it should be

SET OSGEO4W_ROOT=C:\PROGRA~2\QUANTU~1


Since the problem is with the spaces, supplying the short names of the path should solve the problem.

By the way, I'm assuming that you don't have other versions of QGIS. If there's an older version then it would be

C:\PROGRA~2\QUANTU~2


and so on depending on how many older versions there are. Thanks for pointing it out @Andre.

-
It still doesnt work I'm afraid it seems to be the batch files that get called aren't construted properly to handle the spaces. Have I downloaded a duff version or something surely if the app works for no one there'd be a big problem – Richard Timms Sep 18 '12 at 10:38
Updated my answer. Could you try it? – R.K. Sep 18 '12 at 11:00
I am running from the start menu. Also running the bat files from the install directory gives the same result. I found this article hub.qgis.org/issues/5345 which is exactly what I'm seeing but there appears to be no solution – Richard Timms Sep 18 '12 at 11:55
Can you send me a copy of the batch files? – R.K. Sep 18 '12 at 12:00
Setting the path variable with spaces does not make any problem here. With Windows 7, it should be C:\Program Files (x86)\, because it is a 32-bit application. – AndreJ Sep 18 '12 at 12:44

I had exactly the same problem with the standalone installer. Uninstalling QGis, and reinstalling via the OSGeo4W Installer made msys work as it should under Windows 7.

-

There is a new bug around this with QGIS 2.2. See the bug report at https://hub.qgis.org/issues/9751. To workaround on XP, quote all the executables in "C:\Program Files\QGIS Valmiera\apps\msys\msys.bat".

-
To be honest, the bug is not new, but still the same. hub.qgis.org/issues/10001 notes that it has to do with the deactivation of short names compatibility under Windows XP and later. The developers promote to use the OSGEO4W setup, which avoids blanks in pathnames from the start. – AndreJ May 5 '14 at 11:37