I'm trying to run a python script "index.py" in python shell from a .bat file on windows. I tried this first script but it will only open my script in the Python UI without running it :
@echo off
set IDLEDIR=C:\Users\myusername\AppData\Local\Programs\Python\Python39\Lib\idlelib\
set FILEDIR=D:\myfolder\
start "IDLE" "%IDLEDIR%..\..\pythonw.exe" "%IDLEDIR%idle.pyw" %FILEDIR%index.py
pause
I tried this second script, but I have issues with os.listdir(relativefolder/) in my python script, as if the relative folder was not calculated from the script location but from the .bat file location
@echo off
set FILEDIR=D:\myfolder\
python "%FILEDIR%index.py"
pause
Could you help me find out how to fix this ?