Page 1 of 1

Terminating and Executing batch files?

Posted: Sat Feb 13, 2010 4:33 pm
by Hieroglyphics
How would I terminate a batch file if it's running and execute it again?

I tried:

Code: Select all

exec('C:\blah\folder\test.bat');
But nothing happens :/

Re: Terminating and Executing batch files?

Posted: Sat Feb 13, 2010 4:54 pm
by jmetzen
Hi,

It looks to me like your code to execute should work. I set a small test script up on my localhost with a batch file to make sure. So if your batch file isn't executing I don't think I would be able to help without more information about what you're trying to do.

Killing a running process in PHP can get a little more complicated. You might want to start by checking the PHP docs for functions like proc_open(), proc_terminate(), proc_get_status(), etc.

Re: Terminating and Executing batch files?

Posted: Sun Feb 14, 2010 1:35 am
by zamfoo
jmetzen wrote:Hi,

It looks to me like your code to execute should work. I set a small test script up on my localhost with a batch file to make sure. So if your batch file isn't executing I don't think I would be able to help without more information about what you're trying to do.

Killing a running process in PHP can get a little more complicated. You might want to start by checking the PHP docs for functions like proc_open(), proc_terminate(), proc_get_status(), etc.

hi,

you can't. once you call with that command its off and running. termination relies upon termination code in the called script to terminate and return back to the function pointer.

kevin