2012-03-12 24 views
11

Tôi chỉ muốn biết làm thế nào để làm cho cột MEMUSAGE được giảm hoặc tăng thứ tự. Tôi đã tìm kiếm khắp nơi trên web và vẫn không tìm ra câu trả lời, điểm gần nhất tôi nhận được điều này:Cách sắp xếp danh sách tác vụ trong lời nhắc lệnh?

tasklist | sort 

Nhưng khi tôi cố gắng sử dụng/m cho loại ...:

tasklist | sort /m 
Invalid switch. 

Cảm ơn bạn đã giúp đỡ.

Trả lời

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

Số ma thuật 58 tùy thuộc vào đầu ra của bạn.
Sắp xếp tệp theo các ký tự trong cột 58 (Không đảm bảo!).

+0

Làm cách nào bạn biết rằng đó là thứ 58? – Slackware

+0

Trên Windows 8.1, điều này làm việc cho tôi (bộ lọc cho các tác vụ sử dụng hơn 50MB và sắp xếp giảm dần. 'Tasklist/fi 'memusage gt 50000 ″ | sắp xếp/r/+ 65' – bdwakefield

9

Bật tùy chọn/NH trong TASKLIST trước khi chuyển đến SORT. Điều này ngăn chặn tiêu đề bảng gây rối với SORT.

TASKLIST /NH | SORT 
+1

Bạn bỏ qua số cột sắp xếp. SORT/+ 65' hoạt động để sắp xếp kích thước từ nhỏ nhất đến lớn nhất, ít nhất trong Win8.Thêm '/ R' để sắp xếp từ lớn nhất đến nhỏ nhất. – foxidrive

1

Trên thực tế, tất cả các bạn cần làm là gõ như sau:

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

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

Nếu bạn gõ: loại /? bạn có thể nhìn thấy nơi/R liệt kê các mục trong thứ tự giảm dần, xem dưới đây để biết chi tiết:

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. 

này đã được thử nghiệm trên một máy chủ Windows 2008 và Windows 7 SP1

0

OK, vì vậy bỏ qua thông báo của tôi, đã không đọc câu hỏi một cách chính xác. Tôi nghĩ rằng họ chỉ có nghĩa là để có danh sách nhiệm vụ sắp xếp theo thứ tự tăng dần hoặc giảm dần.

tôi sẽ thêm mặc dù rằng nếu họ muốn liệt kê các cột nhớ thứ tự tăng dần nó sẽ giống như dưới đây:

tasklist | sort /+58 

Các/R nói với sắp xếp để liệt kê các mục trong thứ tự giảm dần.

Các vấn đề liên quan