DIR
[/?]
[/A[+|-]drash]
[/S[+|-]drash]
[/O[[+|-]ANEDSG]]
[/T[acw]]
[/L [number]]
[/W [number]]
[/LOCALFORMAT]
[/UTC]
[/COLOUR]
[/MONO]
[/OLDSRCDIR[+|-]]
[/E/U/B/F/H/P/Q[+|-]]
Filespecs…
/?/A/S/E/U/Q/B/F/H/L/NNote: This option is present for backwards compatibility only. Its use should be avoided. In future releases of the DIR command this option will be removed, since the standard meaning for this option of simulate execution has no applicability to the DIR command. It is only present to ease the transition to a DIR command that always uses the "new" style of display format that was introduced with IBM OS/2 version 1 (sic!).
/O/PNote: This option is present for backwards compatibility only.
/TThe dates and times are displayed in the order that they are specified. The default is the same as if /TW had been used.
/W/X/MONO/COLOUR/LOCALFORMAT/UTC/OLDSRCDIRThe DIR command produces values for the extended attribute sizes for files and directories that are different to that produced by the DIR command built in to the 16-bit CMD supplied with IBM OS/2. This is because the DIR command built into the 16-bit CMD supplied with IBM OS/2 is a 16-bit command, which obtains the EA sizes as they appear to 16-bit OS/2, whereas this DIR command is a 32-bit command, which obtains the EA sizes as they appear to 32-bit OS/2.
The DIR command displays the directory entries of all files that match the given search wildcard specifications. If no wildcard specifications are supplied, the default is to display the entries in the current directory.
The DIR command first processes the contents of the CMD_DIR_INIT environment variable, if it has inherited one, as if it were a command tail, before processing any of the command tails that have been passed to it. This allows one to modify default options globally. (One can use command aliases or wrapper scripts to achieve the same effect.)
By default, the last write time, size, extended attribute size, attribute flags, and basename of the file are displayed.
If the /P option is specified, DIR will pipe its standard output and standard error through a pager command. The pager command is specified by the contents of the PAGER environment variable. If there is no PAGER environment variable, the MORE command is used as the default pager command.
DIR invokes the pager command indirectly, by passing it as an argument to the command interpreter given by the COMSPEC environment variable (defaulting to "CMD" if that environment variable does not exist). So, for example, the pager command could be a command script, or a built-in command, or a command pipeline.
If DIR detects that its standard output is neither a pipe nor a file, it will send escape sequences to its standard output to change the colour of directory entries as specified in the DIR_COLOURS environment variable. This can be overridden by using the /MONO and /COLOUR options, to explicitly force or prevent the use of these escape sequences respectively.
DIR matches the colouring rules using the base part of the filename and the file's attributes, and applies each rule in order until one matches. If none of the colouring rules in the DIR_COLOURS environment variable match a file, or if the DIR_COLOURS environment variable does not exist, DIR will send escape sequences to change to white on black. To override this, append a colouring rule with "*" as its wildcard specification to the end of the DIR_COLOURS environment variable.
If colouring is used, DIR will change to white on black at the end of each directory entry displayed. It will do this before sending the newline sequence in order to prevent unsightly results if the screen happens to scroll up when the newline is sent.