| Reference | Downloads | Github

Shell scripting to execute Psychopy and tell it to run a file

Does anyone have any experience trying to script or “batch” the execution of PsychoPy? On Windows, I want to create a file that students can double-click which will both open Psychopy and have it run a particular .py file.

Hi @AlexHolcombe, if you are using the standalone Psychopy the following should work. Create a batch file with the following where PATH = path to psychopy folder and EXP = path to .psyexp file. Note, “-b” arg means to open in Builder view, use -c for coder view and replace your .psyexp experiment file with a .py script.

"[PATH]\PsychoPy2_PY3\python3.exe" "[PATH]\PsychoPy2_PY3\Scripts\" "[EXP]\audioStream.psyexp" -b 
1 Like

Thank you, that works great. Actually because I really just want it to execute the script, not open the app at all, I realised that what I really wanted (in terms of your notation, I am using python27 still) is:

“[PATH]\PsychoPy2_PY3\python3.exe” “[EXPPATH]\audioStream.psyexp”