Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>(we are doing something similar) you star the <code>Postgres</code> service by using this batch file</p> <pre><code>"C:\Program Files\PostgreSQL\9.0\bin\pg_ctl.exe" -D "C:\Program Files\PostgreSQL\9.0\data" start </code></pre> <p>and for [Stopping] the service</p> <pre><code>"C:\Program Files\PostgreSQL\9.0\bin\pg_ctl.exe" -D "C:\Program Files\PostgreSQL\9.0\data" stop </code></pre> <p>where <code>C:\Program Files\PostgreSQL\9.0\bin\pg_ctl.exe</code> is the location of your installation of <code>PostgreSQl</code> which u can get from </p> <pre><code> HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-9.0 </code></pre> <p>Now on running the Batch file to check if the service is indeed running you can use this code from <a href="http://www.dreamincode.net/code/snippet1541.htm" rel="nofollow noreferrer">Process running</a> check for <code>postgres.exe</code> if its running or not.</p> <p>Also 1. <a href="https://stackoverflow.com/questions/4722198/checking-if-windows-application-is-running">checking-if-windows-application-is-running</a> 2. <a href="https://stackoverflow.com/questions/262280/how-can-i-know-if-a-process-is-running">how-can-i-know-if-a-process-is-running</a></p> <pre><code> public bool IsProcessOpen(string name) { //here we're going to get a list of all running processes on //the computer foreach (Process clsProcess in Process.GetProcesses()) { //now we're going to see if any of the running processes //match the currently running processes. Be sure to not //add the .exe to the name you provide, i.e: NOTEPAD, //not NOTEPAD.EXE or false is always returned even if //notepad is running. //Remember, if you have the process running more than once, //say IE open 4 times the loop thr way it is now will close all 4, //if you want it to just close the first one it finds //then add a return; after the Kill if (clsProcess.ProcessName.Contains(name)) { //if the process is found to be running then we //return a true return true; } } //otherwise we return a false return false; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload