0

I have script
pclose(popen("D: & cd D:\server\LoginServer & start /b startLoginServer.bat", "r"));
startloginserver.bat starts java process and i need to get its pid to kill it when needed. I'm new in these things.

Solo Omsarashvili
  • 940
  • 2
  • 11
  • 16
  • 1
    You could use [proc_open](http://php.net/manual/en/function.proc-open.php) and [proc_close](http://php.net/manual/en/function.proc-close.php) instead and then use [proc_get_status](http://php.net/manual/en/function.proc-get-status.php) to get the pid – PhearOfRayne Jan 12 '13 at 07:28
  • Check out the solution in this question: http://stackoverflow.com/questions/4731637/killing-processes-opened-with-popen – Arnaud Jan 12 '13 at 07:32

1 Answers1

0

In cmd to do it there's a command tasklist .. will list the process with pid and then type taskkill /PID pid /F . Note: pid is the listed process id

Manoj Purohit
  • 3,413
  • 1
  • 15
  • 17