0

Setup:

I have 2 batch files:

  1. runs java application (java -jar xyz.jar)
  2. 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

Sweta Jain
  • 3,248
  • 6
  • 30
  • 50

1 Answers1

0

I had the same issue. Unfortunately, I couldn't solve it with the task scheduler. I ended up moving away from the task scheduler and using another tool to schedule tasks.

QStorm
  • 173
  • 12