Usa a lista de tarefas para obter o PID no arquivo em lote

tasklist /FI "ImageName eq cmd.exe" /FI "Status eq Running" /FO CSV
Helpless Hedgehog