MEMUSAGE列を降順または昇順にする方法を知りたかっただけです。Web全体を検索しても答えが見つかりませんでした。最も近いポイントは、次のとおりです。
tasklist | sort
しかし、/ mを並べ替えに使用しようとすると...:
tasklist | sort /m
Invalid switch.
助けてくれてありがとう。
C:\> tasklist | sort /R /+58
魔法の数58
は出力によって異なります。
列の文字に従ってファイルをソートします58
(保証はありません!)。
注:「MemUsage」列でTASKLISTを並べ替える必要もあります。n番目の列でわかりにくい並べ替えをすると少し疲れます。n文字です。
私のコンピューターでは、「MemUsage」列は68番目の列です。正しく計算できるように、メモ帳に貼り付ける必要があります。コマンドラインは次のとおりです。
tasklist | sort /R /+68
SORTにパイプする前に、TASKLISTで/NHオプションを有効にします。これにより、SORTを混乱させるテーブルヘッダーが抑制されます。
TASKLIST /NH | SORT
実際には、次のように入力するだけです。
tasklist | sort (This will sort the list items in ascending order)
tasklist | sort /R (This will sort the list items in descending order)
次のように入力した場合:sort /?/ Rがアイテムを降順でリストしている場所を確認できます。詳細については、以下を参照してください。
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.
これは、Windows2008サーバーとWindows7SP1でテストされました。
ロングコンディショナーも使用できます:
タスクリスト| 並べ替え/メモリ/タイプ/R/ + 35
プロセスのメモリ使用量で非常にきれいに並べ替えます
(注意:2種類の検索を使用することはできません。タスクマネージャーがオプションを変更するようなものではありません。Rogerスクリプトは最初は上で機能しますが、この鉱山(ここでもRogerタイプ)(*若いバージョンタイプ)スクリプトを使用すると再び機能しなくなります。 。
:)
これは、Peer1 DC / Dell /WindowsVistaタイプのスクリプトです。
結果をPID番号で並べ替えるには:
C:\> tasklist /NH | sort /R /+29
/NHは「ヘッダーなし」に使用されます-タスクリストビューのヘッダーをスキップします
/ Rは逆ソート順(降順)に使用されます
/ + 29は、逆にソートされた順序が30番目の文字から始まることを意味します(つまり、29番目の文字の後)
これは、サーバー、ホーム、またはProバージョンのすべてのWindowsCMDプロンプトで機能します。
OK、メッセージを無視して、質問を正しく読んでいませんでした。タスクリストを昇順または降順で並べ替えるだけだと思いました。
ただし、メモリ列を昇順で一覧表示する場合は、次のようになります。
tasklist | sort /+58
/ Rは、アイテムを降順でリストするようにソートを指示します。