Run PostgreSQL function from Windows commandline

A minimal example on how to run a PostgreSQL function from Windows commandline using psql.

PGPATH="C:\Program Files\PostgreSQL\<version>\bin\psql.exe"
PGPASSWORD=<password>
PGPATH -U <user> -d <database> -c "select my_schema.my_function();"

Replace <password>, <user>, <database> with database password, user and name, and <version> with your installed PostgreSQL version.