Steps to reproduce
In the following, it is assumed that WinPython is located at C:\Progs\WPy64-3980.
- Open a Windows command prompt
- Change into a directory outside of the WinPython installation location
- Call
C:\Progs\WPy64-3980\Scripts\cmd.bat
- This results in a syntax error:

Expected behaviour
The WinPython environment should have been set up successfully.
Reason
After some investigation it turns out that the problem is located in env_for_icons.bat and has been introduced by commit d5d7950
The syntax error is thrown here:
|
rem remove some potential last \ |
|
if "%WINPYWORKDIR1:~-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-1% |
There, %WINPYWORKDIR1:~-1% is expanded to a ", not \ or another allowed character as expected. This is since %WINPYWORKDIR1 is set in quotationsmarks now due to the commit mentioned above
|
rem if it it launched from another directory , we keep it that one echo %__CD__% |
|
if not "%__CD__%\"=="%~dp0" set WINPYWORKDIR1="%__CD__%" |
Solution
I am not a Windows batch expert but I guess changing
|
if "%WINPYWORKDIR1:~-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-1% |
to
if "%WINPYWORKDIR1:~-2,-1%"=="\" set WINPYWORKDIR1=%WINPYWORKDIR1:~0,-2%"
should fix the problem. I tested this on my systems (Windows 8.1 and Windows 10 21H1) and it works. However, I do not overlook all possible side effects. @stonebig If you agree with this approach I can make a PR.
Background
I call cmd.bat from a menu entry in my Windows Explorer context menu "Open WinPython 3.9 command prompt here...". This worked well for years (up to at least WPy64-3950), with WPy64-3980 the mentioned problems occured.
Steps to reproduce
In the following, it is assumed that WinPython is located at
C:\Progs\WPy64-3980.C:\Progs\WPy64-3980\Scripts\cmd.batExpected behaviour
The WinPython environment should have been set up successfully.
Reason
After some investigation it turns out that the problem is located in
env_for_icons.batand has been introduced by commit d5d7950The syntax error is thrown here:
winpython/make.py
Lines 1382 to 1383 in e1b823e
There,
%WINPYWORKDIR1:~-1%is expanded to a", not\or another allowed character as expected. This is since%WINPYWORKDIR1is set in quotationsmarks now due to the commit mentioned abovewinpython/make.py
Lines 1378 to 1379 in e1b823e
Solution
I am not a Windows batch expert but I guess changing
winpython/make.py
Line 1383 in e1b823e
to
should fix the problem. I tested this on my systems (Windows 8.1 and Windows 10 21H1) and it works. However, I do not overlook all possible side effects. @stonebig If you agree with this approach I can make a PR.
Background
I call
cmd.batfrom a menu entry in my Windows Explorer context menu "Open WinPython 3.9 command prompt here...". This worked well for years (up to at least WPy64-3950), with WPy64-3980 the mentioned problems occured.