代码如下:PID传给了变量r
@echo off&setlocal enabledelayedexpansionfor /f "delims=, tokens=1,2" %%a in ('tasklist /fo csv /nh') do (set "%%~a_pid=%%~b")set/p "target=请输入要查询的进程名: "set "r=!%target%_pid!"echo [%target%]的PID为: %r%pause