Silent install of postgresql-9.3.1-1-windows-x64 with powershell

Can one tell me plaease where is the wrong in this script line:

Start-Process "$InstallScriptDir/postgresql-9.3.1-1-windows-x64.exe" -NoNewWindow -PassThru -ArgumentList "--mode unattended --prefix C:/Program Files/PostgreSQL/9.3"

I tried also:

Start-Process "$InstallScriptDir/postgresql-9.3.1-1-windows-x64.exe" -NoNewWindow -PassThru -ArgumentList "--mode unattended", " --prefix C:/Program Files/PostgreSQL/9.3"

and in both case i get the same message error:

“There has been an error. Expected option but got “Files/PostgreSQL/9.3”. Options start with a leading “–” prefix.”

I know this is default path for installation, but i want be able to install it in for example: “C:\new program\PostgreSQL\9.3”.

Thanks for help.


The error is caused by the space and not specifying quotation marks.

Start-Process "$InstallScriptDir/postgresql-9.3.1-1-windows-x64.exe" -NoNewWindow -PassThru -ArgumentList 
"--mode unattended --prefix 'C:/Program Files/PostgreSQL/9.3'"

I also tried this but it did not work, maybe it is bug in installer.

Another option is using chocolatey: