How to extract a specific field from output of tasklist on the windows command line
问题 I ran the following command on the windows command prompt C:>tasklist /fi "Imagename eq BitTorrent.exe" The output of which is Image Name PID Session Name Session # Mem Usage ================== ======== ================= =========== ========= BitTorrent.exe 6164 Console 3 24,144K I need to extract only one field, the PID, i.e. the number 6164 from the above output. How do I achieve this ? More generally, how do I extract a subset(1/more) of the fields from the output of a command on the