if you are asking how do you stop the car in that case, well you would have to pull the spark plug leads, depending on which engine you have depends on how you would do this, the early engines are easy to do, but the 24 valve the leads are well hidden
make sure you use a dry rag to insulate ur hand
If you disconnect your battery while the engine is running, then you chance ruining the alternator.
Does the engine continue running for only a short time ?
If so then it is pre-ignition. caused by glowing carbon deposits. and you may need a de-coke.
chadad
When did you last have an oil change ? If your engine oil is contaminated with petrol ( short journeys, plenty of choke) it could be continuing the ignition (self-igniting) as oil etc is drawn past the piston rings into the combustion chamber.