C:\test>type notepid.txt
sleep.exe 2476 Console 1 1,000 K
sleep.exe 2952 Console 1 996 K
@echo off
start notepad joe.txt
sleep 6
tasklist
pause
tasklist | findstr "%1" > notepid.txt
for /f "tokens=1,2 delims= " %%i in (notepid.txt) do (
echo pid=%%j
taskkill /pid %%j
)