Search code examples
sortingcmdtasklist

How to sort the tasklist in the command prompt?


I just wanted to know how to make the MEMUSAGE column be in decreasing or increasing order. I searched all over the web and still did not find the answer, the closest point I got was this:

tasklist | sort

But when I try to use the /m for sort...:

tasklist | sort /m
Invalid switch.

Thanks for any help.


Solution

  • C:\> tasklist | sort /R /+58
    

    The magic number 58 depend on your output.
    Sorts the file according to characters in column 58(No guarantee!).

    Note: I also have demand to sort TASKLIST by the column "Mem Usage". It is a bit tired to me when sorting not friendly by nth column, it is n character

    On my computer, the column "Mem Usage" is the column 68th, I have to paste it into the Notepad to help for calculating correctly. Here is the command line:

    tasklist | sort /R /+68