Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tasklist command only PID needed and piping

Status
Not open for further replies.

rekenaar

Technical User
Feb 16, 2005
38
ZA
Hello. I've got 2 questions.

I am running the Windows tasklist command like so:

Code:
tasklist /fi "STATUS eq running" /fi "Imagename eq notepad.exe" /nh

This returns all the processes of notepad.exe running.
But it gives all the detail (name/PID/memory usage/etc.) My first question is it possible to only return the PID?

My second question if it is possible to pipe the returned PID to the taskkill command to kill a specific process?

Thanks in advance.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top