How to create a new database in PostgreSQL 10 in Windows from batch file?
Create a bat file with the following content and execute it:

c:\path\to\postgresql\bin\psql.exe -f C:\path\to\db_create.sql  postgresql://user:password@localhost:port/postgres


This is what worked for me.