Skip to main content
added link to documentation
Source Link
Ansgar Wiechers
  • 201.5k
  • 27
  • 286
  • 363

From this answer to a similar question on DBA StackExchange:

Set-Location 'C:\Program Files\PostgreSQL\9.6\bin'
$env:PGPASSWORD = 'superPassword'
& .\psql.exe --% --username postgres --command "CREATE USER Ivan WITH CREATEDB PASSWORD 'ivanPassword';"

Note that the stop-parsing symbolstop-parsing symbol (--%) requires PowerShell v3 or newer.

From this answer to a similar question on DBA StackExchange:

Set-Location 'C:\Program Files\PostgreSQL\9.6\bin'
$env:PGPASSWORD = 'superPassword'
& .\psql.exe --% --username postgres --command "CREATE USER Ivan WITH CREATEDB PASSWORD 'ivanPassword';"

Note that the stop-parsing symbol (--%) requires PowerShell v3 or newer.

From this answer to a similar question on DBA StackExchange:

Set-Location 'C:\Program Files\PostgreSQL\9.6\bin'
$env:PGPASSWORD = 'superPassword'
& .\psql.exe --% --username postgres --command "CREATE USER Ivan WITH CREATEDB PASSWORD 'ivanPassword';"

Note that the stop-parsing symbol (--%) requires PowerShell v3 or newer.

Source Link
Ansgar Wiechers
  • 201.5k
  • 27
  • 286
  • 363

From this answer to a similar question on DBA StackExchange:

Set-Location 'C:\Program Files\PostgreSQL\9.6\bin'
$env:PGPASSWORD = 'superPassword'
& .\psql.exe --% --username postgres --command "CREATE USER Ivan WITH CREATEDB PASSWORD 'ivanPassword';"

Note that the stop-parsing symbol (--%) requires PowerShell v3 or newer.