Batch file console not stopping to display the output

Batch file console not stopping to display the output



I'm trying to execute a batch file but its console is not stopping for its output.



here's the code:


goto D:
cd postgresql-9.6.0-1-windows-x64-binaries
cd pgsql
cd bin
start pg_ctl start -D D:pg_datadata
@echo on
echo server started
pause





In general it is always advisable to specify an application or script (batch file) to start with file extension and with full path. I don't know of which type pg_ctl really is because of missing file extension. I suggest to replace everything above @echo on by start "" /D"D:postgresql-9.6.0-1-windows-x64-binariespgsqlbin" "pg_ctl.exe" start -D "D:pg_datadata" or by start "" "D:postgresql-9.6.0-1-windows-x64-binariespgsqlbinpg_ctl.exe" start -D "D:pg_datadata" with assuming the file extension for pg_ctl is .exe. Run in a command prompt window start /? for its help.
– Mofi
Aug 30 at 6:11


pg_ctl


@echo on


start "" /D"D:postgresql-9.6.0-1-windows-x64-binariespgsqlbin" "pg_ctl.exe" start -D "D:pg_datadata"


start "" "D:postgresql-9.6.0-1-windows-x64-binariespgsqlbinpg_ctl.exe" start -D "D:pg_datadata"


pg_ctl


.exe


start /?




1 Answer
1



I am assuming it is on the D: drive. use cd /d see cd /? for the reason why.


cd /d


cd /?


@echo off
cd /d "D:postgresql-9.6.0-1-windows-x64-binariespgsqlbin"
start "" "pg_ctl" start -D "D:pg_datadata"
echo server started
pause



change to start "" /wait if you want to wait for the service to start before you echo it has been started.


start "" /wait





The option /wait does not result in halting batch file execution until pg_ctl is started, it halts batch file execution until pg_ctl has terminated itself. I don't know what pg_ctl really does. It perhaps is just a launcher like start and quickly terminates itself. In this case your description in last sentence is right. Otherwise the usage of /wait would not make much sense if pg_ctl runs for example as long as Windows is running once started.
– Mofi
Aug 30 at 6:16


/wait


pg_ctl


pg_ctl


pg_ctl


start


/wait


pg_ctl





@Mofi Yes, that is what I mean. It is of no use to echo service started if the startup process is still running, so we halt the batch file. That being said, it is still bad to assume the service has started, what if it failed, we still echo service started :)
– Gerhard Barnard
Aug 30 at 6:21


service started


service started





It worked !!! Thank you very much. :)
– Adarsh Singh
Aug 30 at 6:35



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế