I need to get pid
from below command which works if I use it in command line like below:
wmic process where "name="java.exe" and CommandLine like '%%cassandra%%'" get ProcessId | FINDSTR /v ProcessId | FINDSTR /r /v "^$"
but fails if used in .bat file:
FOR /F "tokens=2" %%G IN ('wmic process where ^(name^="java.exe"^ and CommandLine like '%%cassandra%%') get ProcessId ^| FINDSTR /v ProcessId ^| FINDSTR /r /v "^$"') DO (
set PARENT_PID=%%G
)
echo !PARENT_PID!
Can anyone help in this?