I could not find help to this specific question, and I wonder if it has a solution. I have multiple instances of a program running on Windows 7. How can I kill a specific window (maybe based on the filename that is open)?

Background: I have a client application for an ETL software (SAS EG) on my desktop and routinely something goes wrong and a session freezes. But I have many sessions open at the same time, i.e. multiple instances of the program running on my desktop, each having their own session on the remote server. I want to kill just the one that freezed and continue working with the other instances. I know it's possible, I can kill a single instance from Task Manager, but it's a russian roulette since the processes can't be distinguished from one another in Task Manager afaik. Thanks a lot for any help.

  • Is there any difference between the instances like command line options or application path etc? You may kill the process with the associated process id e.g. TASKKILL /PID 1230 /PID 1241 /PID 1253 /T – Biswapriyo Aug 1 '17 at 13:14
  • 1
    If you use SysInternals' Process Explorer you can see all the files open to a process and/or find all processes which have a file open (partial matching can be used). – AFH Aug 1 '17 at 13:26
  • Do the Windows have different titles? – DavidPostill Aug 1 '17 at 13:26
  • @AFH thanks, sounds good. but unfortunately my organization doesn't give us local admin rights so I might not be able to use it. – Probel Aug 1 '17 at 13:41
  • 1
    Additionally, TASKLIST /V does show the Window title. – Pimp Juice IT Aug 1 '17 at 14:54

How can I kill a specific window (maybe based on the filename that is open)?

the windows have different titles according to the filename that is open (in this case project name).

You can use taskkill to kill processes that have windows with a specified title.


Given the following window:

enter image description here

The command to kill that instance of notepad which is editing a file called test.txt is:

taskkill /f /fi "windowtitle eq test.txt*"


>taskkill /f /fi "windowtitle eq test.txt*"
SUCCESS: The process with PID 5356 has been terminated.


  • Replace test.txt* with a string that uniquely identifies your application's window.

Further Reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.