Dos command: dir


command Description
dir /S /O:G /B Display all files including their directories sorted.
dir > list.txt Redirect output from dir to the file list.txt
- if the file does not exist, it is created
- if the file exists, it is overwritten.
dir >> list.txt Redirect and append output from dir to the file list.txt
- if the file does not exist, it is created
- if the file exists, output is appended to end of file.
dir | sort Pipe output from dir to sort.
Output from sort is sent to standard output screen.
dir | sort > c:\dir\list.txt Output from sort is sent to the file c:\dir\list.txt.
dir | sort | more Output from sort is piped to more, more (a filter) delivers output one screenfull at a time.
dir|find "test" Each line that contains "test" will be displayed