tags:

views:

71

answers:

1

hi, I have opened a commnad prompt using java program and another command prompt manually. Now my requirement is that i need to close the command prompt that i have opened by java program using the program.

I tried to close this by giving rt.exec("taskkill /IM cmd.exe");

But the problem is that the command prompt that i have opened manually is aslo closed which i dont want.

Help needed. Thanks in advance

+1  A: 

if you're using Runtime.getRuntime().exec(), it returns a Process object. You should hold on to that and call Process.destroy() when you're done.

John Ellinwood