0

I am finding myself with the issue of needing to execute the postgres createuser.exe from a batch script and cannot get it to stop prompting me with the following:

Enter name of role to add:

my batch script looks like this:

echo calling createuser! createuser username %super_user% -s -U Super_Postgres s -q

Where %super_user% is a command line argument. Any help would be greatly appreciated, this is the documentation that I am referring too: postgres

Milen A. Radev
  • 60,241
  • 22
  • 105
  • 110
Woot4Moo
  • 23,987
  • 16
  • 94
  • 151

2 Answers2

1

from the documentation http://www.postgresql.org/docs/8.4/static/app-createuser.html

The following is from the documentation listed above

To create the same user joe using the server on host eden, port 5000, avoiding the prompts and taking a look at the underlying command:

$ createuser -h eden -p 5000 -S -D -R -e joe
CREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;

To create the user joe as a superuser, and assign a password immediately:

$ createuser -P -s -e joe Enter password for new role: xyzzy Enter it again: xyzzy
CREATE ROLE joe PASSWORD 'md5b5f5ba1a423792b526f799ae4eb3d59e' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;

lofte
  • 864
  • 7
  • 6
1

"username" should go at the end, after the options. You have it as the first parameter.

Alexander Malfait
  • 2,691
  • 1
  • 23
  • 23