postgresqlinno-setupunattended-processing

PostgreSQL installation error with "--" Prefix when located in App dir in C:\Program Files (X86)\


I try to install PostgreSQL within myapp in unattended mode, so created two folders for install postgresql under defualt Dir of myapp as (pgdata - pginstall),

***I try the solution with postgresql_9.6_x86 and 10.5_x86 and 10.5_x64 and 10.6_x86_x64 and 10.6_86. ***Defualt Dir is: C:\Program Files (X86)\myapp

I set command for unattended mode as below: I Used Parameters in Pascal code to allow PostgreSQL run with predefined options as below:

PostgresParams := ExpandConstant('--serverport 5555 --servicename PostgreSQL --superpassword xxxxxxxxxx --unattendedmodeui minimal --debuglevel 2 --mode unattended --prefix {app}\pginstall --datadir {app}\pgdata);

When run myapp.exe, and in step of progress which install prerequisites , PostgreSQL gets error within installation of app as below:

There has been error. Expected option but got "Files". Option start with a leading "--" prefix Use --help to get a list of valid options

when I changed installation Dir to C:\ or D:\ or Any Dir instead of (C:\Program Files (x86)\myapp) the unattended installation of PostgreSQL start and working perfectly.


Solution

  • The installation path typically contains spaces (Program Files), so you always need to wrap it to double-quotes:

    PostgresParams :=
      ExpandConstant('... --prefix "{app}\pginstall" ... --datadir "{app}\pgdata"');