i have an issue with a dos code:
@echo off & set _c=
SET _list=calc.exe StikyNot.exe
echo %_list%
(for %%a in (%_list%) do (
:loop
tasklist /FI "IMAGENAME eq %%a" | find /i "%%a"
goto :_%errorlevel%
:_0
ECHO process is running
taskkill /IM calc.exe /F
set _c=true
Timeout /T 10
goto loop
:_1
IF "%_c%" == "true" (
ECHO l'applicazione process has been killed.
Timeout /T 10
set _c=
goto exitloop)
ECHO process is not running
Timeout /T 5 /Nobreak
goto loop
:exitloop
)
)
the line
tasklist /FI "IMAGENAME eq %%a" | find /i "%%a"
does not accept the %%a parameters. I tried a bat test with the follow code:
ECHO OFF
SET _list=calc.exe StikyNot.exe
(for %%a in (%_list%) do (
echo %%a
))
It print the list without any problem, so i think the issue is the tasklist parameters format. Can you help me?