views:

237

answers:

2

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

+1  A: 

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;

smokeysonora
+1  A: 

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

Alexander Malfait