Skip to content

env.bat and the rest of scripts fail if there are special characters, specifically '&' #716

@emelenas

Description

@emelenas

The env.bat shipped with WinPython failed in my computer. I tracked down the issue to a folder in the PATH variable containing an ampersand (&).

The symptom was spyder and the rest not working, and execution of scripts\env.bat yielded

The system cannot find the path specified

The offending lines are
echo ;%PATH%; | %FINDDIR%\find.exe /C /I ";%WINPYDIR%;" >nul
if %ERRORLEVEL% NEQ 0 set PATH=%WINPYDIR%\Lib\site-packages\PyQt5;%WINPYDIR%\Lib\site-packages\PyQt4;%WINPYDIR%\Lib\site-packages\PySide2;%WINPYDIR%;%WINPYDIR%\DLLs;%WINPYDIR%\Scripts;%WINPYDIR%..\t;%WINPYDIR%..\t\mingw32\bin;%WINPYDIR%..\t\R\bin\i386;%WINPYDIR%..\t\Julia\bin;%WINPYDIR%..\t\n;%PATH%;

Enclosing the PATH variables in double quotes solved the problem, and I believe makes no harm:

echo ";%PATH%;" | %FINDDIR%\find.exe /C /I ";%WINPYDIR%;" >nul
if %ERRORLEVEL% NEQ 0 set PATH="%WINPYDIR%\Lib\site-packages\PyQt5;%WINPYDIR%\Lib\site-packages\PyQt4;%WINPYDIR%\Lib\site-packages\PySide2;%WINPYDIR%;%WINPYDIR%\DLLs;%WINPYDIR%\Scripts;%WINPYDIR%..\t;%WINPYDIR%..\t\mingw32\bin;%WINPYDIR%..\t\R\bin\i386;%WINPYDIR%..\t\Julia\bin;%WINPYDIR%..\t\n;%PATH%;"

An example of a folder name where the problem shows up is:
c:\Program Files (x86)\R&R

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions