0

I search to create a database via CMD, i success to create it using this command:

C:\>"C:\Program Files\PostgreSQL9円.3\bin\psql.exe" -U postgres template1

So when i excute this command i can Create my database like this:

template1=# CREATE DATABASE d_base;

My objectif is to create this database with just one line:

like this:

 C:\>"C:\Program Files\PostgreSQL9円.3\bin\psql.exe" -U postgres template1 "CREATE DATABASE T;"

But this not work with me, it gave me this error:

enter image description here

i can solve this problem with creating a .bat Script but my objectif is to use just one line,

Is there any solution for that.

Thank you.

asked Aug 29, 2016 at 12:24

2 Answers 2

2

You get that error because template1 is not the last argument. You can use -d to specify the database.

Use the database postgres instead of template1.

Try this:

"C:\Program Files\PostgreSQL9円.3\bin\psql.exe" -U postgres -d postgres -c "CREATE DATABASE t"
answered Aug 29, 2016 at 12:31

Comments

2
answered Aug 29, 2016 at 12:31

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.