I need to be able to get the PID from a running process (cmd.exe) using the command line. The problem is there are two cmd.exe running. One is under the username SYSTEM and
This will display all processes named "cmd.exe" for the user "compUser":
tasklist /FI "IMAGENAME eq cmd.exe" /FI "USERNAME eq compUser"