System command

sort command

Reads input, sorts data, and writes the results to the screen, to a file, or to another device. This guide lists the documented syntax and parameters for sort; check Microsoft Learn for version, role and execution-context requirements.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

sort [/r] [/+<N>] [/m <kilobytes>] [/l <locale>] [/rec <characters>] [[<drive1>:][<path1>]<filename1>] [/t [<drive2>:][<path2>]] [/o [<drive3>:][<path3>]<filename3>]

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Syntax pattern

Syntax pattern from Microsoft Learn; replace placeholders and choose only one documented alternative before use.

sort [/r] [/+<N>] [/m <kilobytes>] [/l <locale>] [/rec <characters>] [[<drive1>:][<path1>]<filename1>] [/t [<drive2>:][<path2>]] [/o [<drive3>:][<path3>]<filename3>]

Parameters, options and clauses

Option / clauseDescription
/rMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
/+<N>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/m <kilobytes>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/l <locale>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/rec <characters>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
[<drive1>:][<path1>]<filename1>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/t [<drive2>:][<path2>]Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/o [<drive3>:][<path3>]<filename3>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
/uniqueMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
/?Display command help or the supported command-line usage.
* You can use the pipe symbol (Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<N>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/mMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<kilobytes>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/lMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<locale>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/recMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<characters>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<drive1>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<path1>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<filename1>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/tMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<drive2>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<path2>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
/oMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<drive3>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<path3>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<filename3>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory