Java program to execute taskkill command to kill ping

This java program kills all the ping.exe processes which are running on the system.

Note: “ping.exe” in below code can be changed to any running process to kill it.

Please click here to see various options of taskkill command options.

Java program to execute taskkill command to kill ping:


public class killPing {

	public static void main(String[] args) throws IOException {
		Process pr;
		try {
			pr = Runtime.getRuntime().exec("taskkill /f /im ping.exe");
			BufferedReader reader = new BufferedReader(new InputStreamReader(pr.getInputStream()));
			String line = reader.readLine();
			while (line != null) {
				line = reader.readLine();
		}catch(Exception e){

Leave a Reply

Your email address will not be published. Required fields are marked *