2012-03-12 17 views
11

Po prostu chciałem wiedzieć, jak ustawić kolumnę MEMUSAGE w porządku malejącym lub rosnącym. Szukałem w całym internecie i nadal nie znalazłem odpowiedzi, najbliższy punkt Dostałem to:Jak sortować listę zadań w wierszu polecenia?

tasklist | sort 

Ale gdy próbuję użyć/m dla rodzaju ...:

tasklist | sort /m 
Invalid switch. 

Dzięki za pomoc.

Odpowiedz

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

Magiczna liczba 58 zależy od wyników.
Sortuje plik zgodnie ze znakami w kolumnie 58 (Bez gwarancji!).

+0

Jak się dowiedziałeś, że to było 58.? – Slackware

+0

W systemie Windows 8.1 działało to dla mnie (filtry do zadań używających ponad 50 MB i sortuje malejąco) 'lista zadań/fi" pauza gt 50000 "| sort/r/+ 65' – bdwakefield

9

Włącz opcję/NH w LISTA PRZESZKÓD przed podłączeniem do SORTUJ. To pomija nagłówek tabeli, który miesza się z SORTOWANIEM.

TASKLIST /NH | SORT 
+1

Pominąłeś numer kolumny sortowania. SORT/+ 65' działa, aby posortować rozmiar od najmniejszego do największego, przynajmniej w Win8. Dodaj '/ R', aby sortować od największego do najmniejszego. – foxidrive

1

Faktycznie, wszystko co musisz zrobić, to wpisać:

tasklist | sort (This will sort the list items in ascending order) 

tasklist | sort /R (This will sort the list items in descending order) 

Jeśli wpiszesz sort /? można zobaczyć, gdzie/R wymienia elementy w kolejności malejącej, szczegóły poniżej:

C:\windows\system32>sort /? 
SORT [/R] [/+n] [/M kilobytes] [/L locale] [/REC recordbytes] 
    [[drive1:][path1]filename1] [/T [drive2:][path2]] 
    [/O [drive3:][path3]filename3] 
    /+n       Specifies the character number, n, to 
           begin each comparison. /+3 indicates that 
           each comparison should begin at the 3rd 
           character in each line. Lines with fewer 
           than n characters collate before other lines. 
           By default comparisons start at the first 
           character in each line. 
    /L[OCALE] locale   Overrides the system default locale with 
           the specified one. The ""C"" locale yields 
           the fastest collating sequence and is 
           currently the only alternative. The sort 
           is always case insensitive. 
    /M[EMORY] kilobytes   Specifies amount of main memory to use for 
           the sort, in kilobytes. The memory size is 
           always constrained to be a minimum of 160 
           kilobytes. If the memory size is specified 
           the exact amount will be used for the sort, 
           regardless of how much main memory is 
           available. 

           The best performance is usually achieved by 
           not specifying a memory size. By default the 
           sort will be done with one pass (no temporary 
           file) if it fits in the default maximum 
           memory size, otherwise the sort will be done 
           in two passes (with the partially sorted data 
           being stored in a temporary file) such that 
           the amounts of memory used for both the sort 
           and merge passes are equal. The default 
           maximum memory size is 90% of available main 
           memory if both the input and output are 
           files, and 45% of main memory otherwise. 
    /REC[ORD_MAXIMUM] characters Specifies the maximum number of characters 
           in a record (default 4096, maximum 65535). 
    /R[EVERSE]     Reverses the sort order; that is, 
           sorts Z to A, then 9 to 0. 
    [drive1:][path1]filename1 Specifies the file to be sorted. If not 
           specified, the standard input is sorted. 
           Specifying the input file is faster than 
           redirecting the same file as standard input. 
    /T[EMPORARY] 
    [drive2:][path2]   Specifies the path of the directory to hold 
           the sort's working storage, in case the data 
           does not fit in main memory. The default is 
           to use the system temporary directory. 
    /O[UTPUT] 
    [drive3:][path3]filename3 Specifies the file where the sorted input is 
           to be stored. If not specified, the data is 
           written to the standard output. Specifying 
           the output file is faster than redirecting 
           standard output to the same file. 

Zostało to przetestowane na serwerze Windows 2008 i Windows 7 SP1

0

OK, więc ignorować moją wiadomość, nie przeczytaj poprawnie pytanie. Myślałem, że po prostu mają sortować listę zadań w porządku rosnącym lub malejącym.

Dodam jednak, że gdyby chcieli wymienić kolumnę pamięci w kolejności rosnącej byłoby jak poniżej:

tasklist | sort /+58 

Przełącznik/R mówi porządek do listy produktów w kolejności malejącej.

Powiązane problemy