Terminating and Executing batch files?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Hieroglyphics
Forum Newbie
Posts: 13
Joined: Wed Jan 20, 2010 8:25 pm

Terminating and Executing batch files?

Post 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 :/
jmetzen
Forum Newbie
Posts: 5
Joined: Sat Feb 13, 2010 1:16 pm

Re: Terminating and Executing batch files?

Post 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.
zamfoo
Forum Newbie
Posts: 5
Joined: Fri Feb 12, 2010 11:09 pm

Re: Terminating and Executing batch files?

Post 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
Post Reply