2016-05-19 2 views
0

inno setupを使用していて、postgresをインストールしようとしていますが、実行セクションでサーバを起動できません。管理者としてログインしています。postgresのインストールを有効にするためにinno-setupで継続的なcmdプロンプトを作成する

postgresを実行できるように連続したcmdプロンプトを作成する方法を知っている人はいますか?

[Run] 

Filename: "{cmd}"; Flags: runasoriginaluser; Parameters: "/k{src}\..\pgsql\bin/pg_ctl register -N postgres -U postgres -P postgres -D C:\eltfiles\pgsql\data -W -t -o {src}\..\pgsql\bin/initdb -U postgres -A password -E utf8 --pwfile={src}\..\pgsql\bin\password.txt -D C:\xxxfiles\pgsql\data" 

Filename: "{cmd}"; Flags: runasoriginaluser; Parameters: "/k {src}\..\pgsql\bin/pg_ctl -D C:\xxxfiles\pgsql\data -l logfile start" 
+0

あなたは詳しく説明できますか?私はあなたが何を求めているのか分かりません。多少のスクリーンショットが役立つかもしれません。 –

+0

最初のプロンプトでdbを初期化した後、2番目のプロンプトを使用してデータベースを起動しますが、アクセス拒否エラーが発生するためできません。 –

+0

光補正 – LoicTheAztec

答えて

0

はちょうどこのようなあなたの実行のセクションで(サイレント)インストールを実行します:

[Run] 
Filename: "{tmp}\postgresql.exe"; Parameters: "--mode unattended --unattendedmodeui none --datadir {commonappdata}\PostgreSQL\8.4\data --install_runtimes 0"; AfterInstall: CreateDatabase; 

コールあなたAfterInstallからこの方法:

function CreateDatabase() : Boolean; 
var 
    InstallPath: String; 
    DataPath: String; 
    ResultCode: Integer; 

begin 
    Result := False; 

    InstallPath := ExpandConstant('{pf}\PostgreSQL\8.4\bin'); 
    DataPath := ExpandConstant('{#ProgramDataDirectory}\PostgreSQL\8.4\data'); 

    //Clear old data out 
    DelTree(DataPath, True, True, True); 

    // First we must initialise our server 
    if Exec(InstallPath + '\initdb', '-D ' + DataPath, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then 
    begin 
    // Now start our postgres process 
    if Exec(InstallPath + '\pg_ctl', 'start -w -D ' + DataPath, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then 
    begin 
     // Create our database user 
     if Exec(InstallPath + '\createuser', '-w -d -R -S username', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then 
     begin 
     // Create our database 
     if Exec(InstallPath + '\createdb', 'database', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then  
      Result := True; 
     end; 
     end; 
    end; 
    end 
end; 
ここ

は私のコードです

これは以前と同じようなものを使いました。

関連する問題