Starting PsychoPy app from CMD or Powershell

I’m on Windows10 with v2020.2.3 and I only recently found out that I could open the Psychopy app from the command line.

When I’m in the Psychopy folder, what I can do in Powershell is:

  • Open the coder: .\pythonw.exe .\Lib\site-packages\psychopy\app\ -c
  • Open the builder: .\pythonw.exe .\Lib\site-packages\psychopy\app\ -b
  • Skip the splash-screen: .\pythonw.exe .\Lib\site-packages\psychopy\app\ -b --no-splash
  • Open a .psyexp file in the builder: .\pythonw.exe .\Lib\site-packages\psychopy\app\ Path\To\File.psyexp

But some functionalities specified in the help do not work for me:

  • Open a .py file in the coder: .\pythonw.exe .\Lib\site-packages\psychopy\app\ Path\To\
  • Start an experiment from the commandline: .\pythonw.exe .\Lib\site-packages\psychopy\app\ -x Path\To\

Did someone manage to start an experiment from CMD or Powershell?

So the way incoming arguments are dealt with is it first looks for -b, -c and -r (or -builder, -coder and -runner) in the arguments and decides from that which windows need to be open. If there is a filename after ending in .psyexp or .psyrun, then it will force the Builder or Runner window respectively to open and will open that file in it. This override isn’t there for .py files as the app itself is a .py file - however, you can open experiments directly in Coder via command line by specifying -c, like so:

.\pythonw.exe .\Lib\site-packages\psychopy\app\ -c Path\To\

We don’t have anything setup for running experiments directly from command line. In theory it wouldn’t be too difficult, with the latest version we upgraded from manual string parsing for arguments to using the argparse package so it’s quite simple to add new arguments now, but there’s not been much demand for it really.

1 Like

Thank you for your detailed answer :slight_smile:

This doesn’t work for me, but you seem to have changed the file with your switch to the argparse package, so maybe it will work with the new release.

Ah yes, that’s where the argument parsing happens. If you upgrade to the latest release it should work!

1 Like

In case someone ends up at this post looking for help, here is the Powershell Script I use to start PsychoPy:

function Start-Psychopy{
    # Author: Lukas Kirst
        [string]$path = $null

    $StandAlonePython = "${env:ProgramFiles}\PsychoPy3\pythonw.exe"
    $PsychopyApp = "${env:ProgramFiles}\PsychoPy3\Lib\site-packages\psychopy\app\"

    if ($b) {
        $flag = "-b"
    } elseif ($c){
        $flag = "-c"
    } elseif ($r){
        $flag = "-r"
    } else {
        $flag = $null

    # make the path absolute
    if (-NOT [string]::IsNullOrEmpty($path)){
        $path = Resolve-Path $path

    # run the psychopy app
    & $StandAlonePython $PsychopyApp --no-splash $flag $path