You must connect to a database to run a command, even if you want to run CREATE DATABASE
, so:
"C:\..\psql.exe" -h my_server_host -U usr -c 'CREATE DATABASE test;' postgres
(As @Craig cleared up, it must be double quotes for Windows.)
Using the default maintenance db postgres
here.
There is a better option for the purpose at hand, though: createdb from the command-line directly.