It was something like this. It would just kill all tasks that haven’t responded in X amount of time. Obviously this is not a great solution as it can cause data loss and you could accidentally close more than just the program you intend to close, but sometimes you have little choice.
It wasn’t something I kept running, just a shortcut that would run the batch file and kill anything that wasn’t responding at the time. I’m not sure if this uses the same command I had set up at the time, but I remember it having a 100% success rate. I had it for one game in particular which would crash and stop responding but any attempts to get to the task manager (even with keyboard) would fail.
I haven’t had to use anything like this since Windows 10 as now you can just press Windows+Tab and move the task to a different desktop and then get into the task manager on your original desktop.