How to use Dir Command In Windows Server 2008

This article shows how to use Dir command in Windows Server 2008 operating system and also explains the syntax related with it.
  • 2980

Introduction

Dir command in Windows Server 2008 operating system is used to show the list of directory's files and subdirectories. This command is also used to show total number of files and directories listed, their size and free space remaining on the disk. Syntax for Dir command is given below.

Syntax

dir [<Drive>: ] [<Path>] [<Filename>] [ . . . ] [/p] [/q] [/w] [/d] [/a [ [ : ]<Attributes>] ] [ /o [ [ : ]<SortOrder>] ]  [/t [ [ : ]<TimeField>] ]  [/s] [/b] [/l] [/n] [/x] [/c] [/4]

Parameters For Dir

Parameter Description
[<Drive>:][<Path>] Defines the drive and directory for which you want to see a listing.
[<FileName>] Describes a particular file or group of files for which you want to see a listing.
/p Shows one screen of the listing at a time.
/q Shows file ownership information.
/w Shows the listing in wide format.
/d Shows the listing in the same format as /w.
/a[[:]<Attributes>] Shows only the names of those directories and files with the attributes that user specify.
/o[[:]<SortOrder>] Used to sort the output according to SortOrder.
/t[[:]<TimeField>] Defines which time field to display or use for sorting.
/s Lists every occurrence of the specified file name within the specified directory and all subdirectories.
/b Shows a bare list of directories and files, with no additional information.
/l Shows unsorted directory names and file names in lowercase.
/n Shows a long list format with file names on the far right of the screen.
/x Shows the short names generated for non-8dot3 file names.
/c Shows the thousand separator in file sizes.
/4 Shows years in four-digit format.
/? Shows help at the command prompt.

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2018 DotNetHeaven. All rights reserved.