@@ -1326,6 +1326,13 @@ def _create_batch_scripts_initial(self):
13261326 r"""@echo off
13271327call "%~dp0env.bat"
13281328set WINPYWORKDIR=%~dp0..\Notebooks
1329+
1330+ set WINPYWORKDIR1=%~dp1
1331+ if "%WINPYWORKDIR1%"=="" (
1332+ if not "%CD%\"=="%~dp0" set WINPYWORKDIR1=%CD%
1333+ )
1334+ if "%WINPYWORKDIR1%"=="" set WINPYWORKDIR1=%WINPYWORKDIR%
1335+
13291336FOR /F "delims=" %%i IN ('cscript /nologo "%~dp0WinpythonIni.vbs"') DO set winpythontoexec=%%i
13301337%winpythontoexec%set winpythontoexec=
13311338
@@ -1549,14 +1556,14 @@ def _create_batch_scripts(self):
15491556 self .create_batch_script (
15501557 'cmd.bat' ,
15511558 r"""@echo off
1552- call "%~dp0env_for_icons.bat"
1559+ call "%~dp0env_for_icons.bat" %*
15531560cmd.exe /k""" ,
15541561 )
15551562
15561563 self .create_batch_script (
15571564 'python.bat' ,
15581565 r"""@echo off
1559- call "%~dp0env_for_icons.bat"
1566+ call "%~dp0env_for_icons.bat" %*
15601567rem backward compatibility for python command-line users
15611568"%WINPYDIR%\python.exe" %*
15621569""" ,
@@ -1565,8 +1572,8 @@ def _create_batch_scripts(self):
15651572 self .create_batch_script (
15661573 'winpython.bat' ,
15671574 r"""@echo off
1568- call "%~dp0env_for_icons.bat"
1569- cd/D "%WINPYWORKDIR %"
1575+ call "%~dp0env_for_icons.bat" %*
1576+ cd/D "%WINPYWORKDIR1 %"
15701577rem backward compatibility for non-ptpython users
15711578if exist "%WINPYDIR%\scripts\ptpython.exe" (
15721579 "%WINPYDIR%\scripts\ptpython.exe" %*
@@ -1579,7 +1586,7 @@ def _create_batch_scripts(self):
15791586 self .create_batch_script (
15801587 'idlex.bat' ,
15811588 r"""@echo off
1582- call "%~dp0env_for_icons.bat"
1589+ call "%~dp0env_for_icons.bat" %*
15831590rem backward compatibility for non-IDLEX users
15841591if exist "%WINPYDIR%\scripts\idlex.pyw" (
15851592 "%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %*
@@ -1592,16 +1599,17 @@ def _create_batch_scripts(self):
15921599 self .create_batch_script (
15931600 'idle.bat' ,
15941601 r"""@echo off
1595- call "%~dp0env_for_icons.bat"
1602+ call "%~dp0env_for_icons.bat" %*
15961603"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %*
15971604
15981605""" ,
15991606 )
16001607 self .create_batch_script (
16011608 'winidlex.bat' ,
16021609 r"""@echo off
1603- call "%~dp0env_for_icons.bat"
1604- cd/D "%WINPYWORKDIR%"
1610+
1611+ call "%~dp0env_for_icons.bat" %*
1612+ cd/D "%WINPYWORKDIR1%"
16051613rem backward compatibility for non-IDLEX users
16061614if exist "%WINPYDIR%\scripts\idlex.pyw" (
16071615 "%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %*
@@ -1613,42 +1621,41 @@ def _create_batch_scripts(self):
16131621 self .create_batch_script (
16141622 'winidle.bat' ,
16151623 r"""@echo off
1616- call "%~dp0env_for_icons.bat"
1617- cd/D "%WINPYWORKDIR %"
1624+ call "%~dp0env_for_icons.bat" %*
1625+ cd/D "%WINPYWORKDIR1 %"
16181626"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %*
16191627""" ,
16201628 )
16211629
16221630 self .create_batch_script (
16231631 'spyder.bat' ,
16241632 r"""@echo off
1625- call "%~dp0env_for_icons.bat"
1626- cd/D "%WINPYWORKDIR%"
1633+ call "%~dp0env_for_icons.bat" %*
1634+ rem cd/D "%WINPYWORKDIR%"
16271635if exist "%WINPYDIR%\scripts\spyder3.exe" (
1628- "%WINPYDIR%\scripts\spyder3.exe" %*
1636+ "%WINPYDIR%\scripts\spyder3.exe" %* -w "%WINPYWORKDIR1%"
16291637) else (
1630- "%WINPYDIR%\scripts\spyder.exe" %*
1631- )
1638+ "%WINPYDIR%\scripts\spyder.exe" %* -w "%WINPYWORKDIR1%"
1639+ )
16321640""" ,
16331641 )
16341642 self .create_batch_script (
16351643 'winspyder.bat' ,
16361644 r"""@echo off
1637- call "%~dp0env_for_icons.bat"
1638- cd/D "%WINPYWORKDIR%"
1645+ call "%~dp0env_for_icons.bat" %*
1646+ rem cd/D "%WINPYWORKDIR%"
16391647if exist "%WINPYDIR%\scripts\spyder3.exe" (
1640- "%WINPYDIR%\scripts\spyder3.exe" %*
1648+ "%WINPYDIR%\scripts\spyder3.exe" %* -w "%WINPYWORKDIR1%"
16411649) else (
1642- "%WINPYDIR%\scripts\spyder.exe" %*
1643- )
1650+ "%WINPYDIR%\scripts\spyder.exe" %* -w "%WINPYWORKDIR1%"
16441651""" ,
16451652 )
16461653
16471654 self .create_batch_script (
16481655 'spyder_reset.bat' ,
16491656 r"""@echo off
1650- call "%~dp0env_for_icons.bat"
1651- cd/D "%WINPYWORKDIR %"
1657+ call "%~dp0env_for_icons.bat" %*
1658+ cd/D "%WINPYWORKDIR1 %"
16521659if exist "%WINPYDIR%\scripts\spyder3.exe" (
16531660 "%WINPYDIR%\scripts\spyder3.exe" --reset %*
16541661) else (
@@ -1660,53 +1667,53 @@ def _create_batch_scripts(self):
16601667 self .create_batch_script (
16611668 'ipython_notebook.bat' ,
16621669 r"""@echo off
1663- call "%~dp0env_for_icons.bat"
1664- cd/D "%WINPYWORKDIR %"
1670+ call "%~dp0env_for_icons.bat" %*
1671+ cd/D "%WINPYWORKDIR1 %"
16651672"%WINPYDIR%\scripts\jupyter-notebook.exe" %*
16661673""" ,
16671674 )
16681675
16691676 self .create_batch_script (
16701677 'winipython_notebook.bat' ,
16711678 r"""@echo off
1672- call "%~dp0env_for_icons.bat"
1673- cd/D "%WINPYWORKDIR %"
1679+ call "%~dp0env_for_icons.bat" %*
1680+ cd/D "%WINPYWORKDIR1 %"
16741681"%WINPYDIR%\scripts\jupyter-notebook.exe" %*
16751682""" ,
16761683 )
16771684
16781685 self .create_batch_script (
16791686 'winjupyter_lab.bat' ,
16801687 r"""@echo off
1681- call "%~dp0env_for_icons.bat"
1682- cd/D "%WINPYWORKDIR %"
1688+ call "%~dp0env_for_icons.bat" %*
1689+ cd/D "%WINPYWORKDIR1 %"
16831690"%WINPYDIR%\scripts\jupyter-lab.exe" %*
16841691""" ,
16851692 )
16861693
16871694 self .create_batch_script (
16881695 'qtconsole.bat' ,
16891696 r"""@echo off
1690- call "%~dp0env_for_icons.bat"
1691- cd/D "%WINPYWORKDIR %"
1697+ call "%~dp0env_for_icons.bat" %*
1698+ cd/D "%WINPYWORKDIR1 %"
16921699"%WINPYDIR%\scripts\jupyter-qtconsole.exe" %*
16931700""" ,
16941701 )
16951702
16961703 self .create_batch_script (
16971704 'winqtconsole.bat' ,
16981705 r"""@echo off
1699- call "%~dp0env_for_icons.bat"
1700- cd/D "%WINPYWORKDIR %"
1706+ call "%~dp0env_for_icons.bat" %*
1707+ cd/D "%WINPYWORKDIR1 %"
17011708"%WINPYDIR%\scripts\jupyter-qtconsole.exe" %*
17021709""" ,
17031710 )
17041711
17051712 self .create_batch_script (
17061713 'qtdemo.bat' ,
17071714 r"""@echo off
1708- call "%~dp0env_for_icons.bat"
1709- cd/D "%WINPYWORKDIR %"
1715+ call "%~dp0env_for_icons.bat" %*
1716+ cd/D "%WINPYWORKDIR1 %"
17101717if exist "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py" (
17111718 "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py"
17121719)
@@ -1719,8 +1726,8 @@ def _create_batch_scripts(self):
17191726 self .create_batch_script (
17201727 'qtdesigner.bat' ,
17211728 r"""@echo off
1722- call "%~dp0env_for_icons.bat"
1723- cd/D "%WINPYWORKDIR %"
1729+ call "%~dp0env_for_icons.bat" %*
1730+ cd/D "%WINPYWORKDIR1 %"
17241731if "%QT_API%"=="" ( set QT_API=pyqt5 )
17251732if "%QT_API%"=="pyqt5" (
17261733 if exist "%WINPYDIR%\Scripts\designer.exe" (
@@ -1743,8 +1750,8 @@ def _create_batch_scripts(self):
17431750 self .create_batch_script (
17441751 'qtassistant.bat' ,
17451752 r"""@echo off
1746- call "%~dp0env_for_icons.bat"
1747- cd/D "%WINPYWORKDIR %"
1753+ call "%~dp0env_for_icons.bat" %*
1754+ cd/D "%WINPYWORKDIR1 %"
17481755if "%QT_API%"=="" ( set QT_API=pyqt5 )
17491756if "%QT_API%"=="pyqt5" (
17501757 if exist "%WINPYDIR%\Scripts\assistant.exe" (
@@ -1767,8 +1774,8 @@ def _create_batch_scripts(self):
17671774 self .create_batch_script (
17681775 'qtlinguist.bat' ,
17691776 r"""@echo off
1770- call "%~dp0env_for_icons.bat"
1771- cd/D "%WINPYWORKDIR %"
1777+ call "%~dp0env_for_icons.bat" %*
1778+ cd/D "%WINPYWORKDIR1 %"
17721779if "%QT_API%"=="" ( set QT_API=pyqt5 )
17731780if "%QT_API%"=="pyqt5" (
17741781 if exist "%WINPYDIR%\Scripts\linguist.exe" (
@@ -1805,8 +1812,8 @@ def _create_batch_scripts(self):
18051812 self .create_batch_script (
18061813 'wpcp.bat' ,
18071814 r"""@echo off
1808- call "%~dp0env_for_icons.bat"
1809- cd/D "%WINPYWORKDIR %"
1815+ call "%~dp0env_for_icons.bat" %*
1816+ cd/D "%WINPYWORKDIR1 %"
18101817"%WINPYDIR%\python.exe" -m winpython.controlpanel %*
18111818""" ,
18121819 )
@@ -1829,7 +1836,7 @@ def _create_batch_scripts(self):
18291836 self .create_batch_script (
18301837 'winpyzo.bat' ,
18311838 r"""@echo off
1832- call "%~dp0env_for_icons.bat"
1839+ call "%~dp0env_for_icons.bat" %*
18331840cd/D "%WINPYDIR%"
18341841"%WINPYDIR%\scripts\pyzo.exe" %*
18351842""" ,
@@ -1853,8 +1860,8 @@ def _create_batch_scripts(self):
18531860 'winvscode.bat' ,
18541861 r"""@echo off
18551862rem launcher for VScode
1856- call "%~dp0env_for_icons.bat"
1857- rem cd/D "%WINPYWORKDIR %"
1863+ call "%~dp0env_for_icons.bat" %*
1864+ rem cd/D "%WINPYWORKDIR1 %"
18581865if exist "%WINPYDIR%\..\t\vscode\code.exe" (
18591866 "%WINPYDIR%\..\t\vscode\code.exe" %*
18601867) else (
0 commit comments