Question: I have a bat that starts 3 separate java windows like so:

```
start java -jar somejar.jar
start java -jar _the_jar_I_want_to_close_.jar
start java -jar someotherjar.jar

```

I need a bat command that closes ***ONLY*** \_the\_jar\_I\_want\_to\_close\_.jar. Unfortunately the only thing that differentiates these windows is the PID, but the PID changes every time they're launched.

Here's what I've tried
----------------------

1. Taskkill by PID `taskkill /PID ####` **Problem:** The PID is not constant.
2. Killing all processes from java `taskkill /IM java.exe` **Problem:** There are 2 other java windows that I don't want to stop
3. Killing all processes by image name: `taskkill /IM java` **Problem:** Same as above, only need to kill one window, not all three.

Possibilities?
--------------

1. Is it possible to name the windows when I start them, so I can reference that name later?

Answer: 
You can use `plink.exe` to start your existing putty session.

Create a new profile entry for Windows Terminal like this, where `putty-session` is the name of your putty session:

```
{
    "guid": "{141d171c-4fd9-426d-9008-8cbc4b0b05d3}",
    "name": "putty-session",
    "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
    "commandline": "plink.exe -load \"putty-session\""
}

```

For more details see this answer:
<https://stackoverflow.com/questions/57363597/how-to-use-a-new-windows-terminal-app-for-ssh>
There is a *fork* of Putty that has a robust preferences menu where you can configure it to run in windows terminal.
As documented [here](https://www.vcloudinfo.com/2019/06/putty-putty-putty-windows-terminal.html)

As far as I know, there is currently no way to enable *standard* Putty to run within Windows Terminal.

Also, see [this GitHub issue](https://github.com/microsoft/terminal/issues/1917#issuecomment-510259173) where they explain that since Putty is actually a complete GUI application it *can't* run within Windows Terminal.