TASKLIST Command Process Count

Jun 2, 2008
314
1
Newton, MA
In going from version 19 to 25, I ran into a problem because the TASKLIST command added a line with the count of processes at the end (and a blank line before that), badly messing up one of my scripts. To my surprise, there does not seem to be the usual option to suppress such extra information (cf. /K and /M in DIR). If I have not simply overlooked something, could you please add such an option.
 
Hey @Jay Sage would something like this get around the change;
Code:
tasklist > clip: && head /n%@dec[%@lines[clip:]] clip:
Using tasklist;
Code:
 5472  period_search_10210_windows_x86_64__avx
  196  firefox
11272  firefox
 3612  period_search_10210_windows_x86_64__avx
15876  svchost
 6824  period_search_10210_windows_x86_64__avx

   Total of 193 processes

e:\utils>
Using one-liner;
Code:
 5472  period_search_10210_windows_x86_64__avx
  196  firefox
11272  firefox
 3612  period_search_10210_windows_x86_64__avx
15876  svchost
 6824  period_search_10210_windows_x86_64__avx

e:\utils>
Adjust as necessary.

Joe
 
May 20, 2008
10,635
82
Syracuse, NY, USA
Or, if you don't mind using FINDSTR,

Code:
tasklist |! findstr /v "^$ Total of"
You could do the same with TPIPE (grep).
 
Jun 2, 2008
314
1
Newton, MA
Thanks for the suggestions. I already implemented a workaround, but no workaround should have been required. There should be an option to get clean output that can be fed to another command -- especially when a command is changed in a new version to add headers or footers that were not there before.
 
Jun 2, 2008
314
1
Newton, MA
Also, by the way, there is also a blank line before the process total. It, too, needed to be removed.