Setup:
I have 2 batch files:
- runs java application (java -jar xyz.jar)
- search for given application and kills it: (for /f "tokens=1" %%i in ('jps -m ^| find "xyza"') do ( taskkill /F /PID %%i ))
When I run 1. and execute 2. from cmd everything works fine.
Problem: When I run 1. from the task scheduler and execute 2. the jps won't find the application (jps does not find the application)
I have multiple java applications so I cant do "taskkill java.exe" (as I need to kill just this one)
How to run 1. so jps can "see it"?
I have found the same problem posted 7 years ago, however, the presented solutions do not work for me: Batch File runs manually but not in task scheduler