Jul 17 2021 06:59 AM - last edited on Nov 09 2023 11:09 AM by
Jul 17 2021 07:48 AM
Found the solution.
:: cd app directory, and start it
cd C:\Users\Xylome\Documents\ebooks
start cmd.exe /k "ipython --pylab"
Here it is. Thank you.
Jul 18 2021 01:09 AM - edited Jul 18 2021 01:13 AM
Solution
@echo off
PushD E:\myDir\script
Echo Python prompt in the folder %cd%
:: If you want to be sure remove the following comment
:: c:\path\to\python\python.exe -c "import os ; cwd=os.getcwd();print(cwd)"
cmd.exe /k c:\path\to\python\python.exe
PushD change disk and folder (equivalent to cd E:\myDir\script & E:)
If python is non in the path enviroment variable you need the full path to python exe ...
Jul 18 2021 01:41 PM
Mar 28 2023 08:26 AM - edited Mar 28 2023 08:32 AM
and for those who keep looking:
@echo off
cd /d your_path
python.exe
pause
Path like this D:\dir1\dir2
This assumes python is added to PATH
Instead of running python, you can run a python program replacing 'python.exe' with i.e. 'python program.py'
As well maybe you want to activate a virtual environment first (i.e. named 'venv' and placed in the same directory)
@echo off
cd /d your_path
call venv\Scripts\activate
python program.py
pause
The 'pause' command at the end of the script keeps the command prompt window open.
Jul 18 2021 01:09 AM - edited Jul 18 2021 01:13 AM
Solution
@echo off
PushD E:\myDir\script
Echo Python prompt in the folder %cd%
:: If you want to be sure remove the following comment
:: c:\path\to\python\python.exe -c "import os ; cwd=os.getcwd();print(cwd)"
cmd.exe /k c:\path\to\python\python.exe
PushD change disk and folder (equivalent to cd E:\myDir\script & E:)
If python is non in the path enviroment variable you need the full path to python exe ...