dir (命令)

dir (命令)

此条目的主題是是一個電腦指令。关于Dir的其他意義,請見「Dir」。

dir (directory,目錄)是一個條列檔案及目錄的命令行界面指令,在CP/M、VMS、DOS、OS/2、Singularity及Microsoft Windows等作業系統中都有此指令。

dir指令基本上會列出目录中的檔案及子目录的名稱,也可以列出其檔案大小,建立時間等相關資訊,並且列出所在的磁碟機、可用空間等資訊。dir指令也可以尋找其檔案名稱符合特定條件的檔案。

用法範例[编辑]

以下的範例是在Windows 7中給dir指令,沒有指令列引數時的輸出:

C:\Users\Public\Pictures\Sample Pictures>dir

Volume in drive C is System

Volume Serial Number is C8D0-76E2

Directory of C:\Users\Public\Pictures\Sample Pictures

14-07-2009 06:41

.

14-07-2009 06:41

..

14-07-2009 06:52 879,394 Chrysanthemum.jpg

14-07-2009 06:52 845,941 Desert.jpg

14-07-2009 06:52 595,284 Hydrangeas.jpg

14-07-2009 06:52 775,702 Jellyfish.jpg

14-07-2009 06:52 780,831 Koala.jpg

14-07-2009 06:52 561,276 Lighthouse.jpg

14-07-2009 06:52 777,835 Penguins.jpg

14-07-2009 06:52 620,888 Tulips.jpg

8 File(s) 5,837,151 bytes

2 Dir(s) 57,925,980,160 bytes free

C:\Users\Public\Pictures\Sample Pictures>dir /w

Volume in drive C is System

Volume Serial Number is C8D0-76E2

Directory of C:\Users\Public\Pictures\Sample Pictures

[.] [..] Chrysanthemum.jpg Desert.jpg Hydrangeas.jpg Jellyfish.jpg

Koala.jpg Lighthouse.jpg Penguins.jpg Tulips.jpg

8 File(s) 5,837,151 bytes

2 Dir(s) 57,925,992,448 bytes free

C:\Users\Public\Pictures\Sample Pictures>

選項及指令列引數[编辑]

以下是Microsoft Windows下,dir指令的選項及指令列引數

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]

[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]

Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.

attributes D Directories R Read-only files

H Hidden files A Files ready for archiving

S System files I Not content indexed files

L Reparse Points - Prefix meaning not

/B Uses bare format (no heading information or summary).

/C Display the thousand separator in file sizes. This is the

default. Use /-C to disable display of separator.

/D Same as wide but files are list sorted by column.

/L Uses lowercase.

/N New long list format where filenames are on the far right.

/O List by files in sorted order.

sortorder N By name (alphabetic) S By size (smallest first)

E By extension (alphabetic) D By date/time (oldest first)

G Group directories first - Prefix to reverse order

/P Pauses after each screenful of information.

/Q Display the owner of the file.

/R Display alternate data streams of the file.

/S Displays files in specified directory and all subdirectories.

/T Controls which time field displayed or used for sorting timefield.

C Creation

A Last Access

W Last Written

/W Uses wide list format.

/X This displays the short names generated for non-8dot3 file names. The format is that of /N with the

name inserted before the long name. If no short name is present, blanks are displayed in its place.

/4 Displays four-digit years.

選項可以放在DIRCMD環境變數中,若要關閉現有的設定,可以在選項前加上-,例如/-W。

[1]

Unix[编辑]

dir不是Unix指令,Unix有類似的指令ls,不過GNU/Linux作業系統中有dir指令,等效於ls -C -b[2]。

相關條目[编辑]

MS-DOS命令列表

參考資料[编辑]

^ Windows 7

^ dir invocation (GNU coreutils) at www.gnu.org

查论编Windows命令行程序和殼層內建指令

COMMAND.COM

命令提示字元

Windows PowerShell

復原主控台

文件管理导航

cd (chdir)

dir

pushd

popd

tree

文件管理操作

attrib(英语:ATTRIB)

cacls

cipher

compact

copy

del(英语:del (command)) (erase)

deltree(英语:deltree)

|expand

icacls

|makecab

md (mkdir)

move(英语:move (command))

rd (rmdir)

recover(英语:recover (command))

ren(英语:ren (command)) (rename)

replace(英语:replace (command))

Rmdir

robocopy(英语:robocopy)

xcopy(英语:XCOPY)

磁盘管理

chkdsk

convert(英语:convert (command))

defrag

diskcomp(英语:diskcomp)

diskcopy(英语:diskcopy)

diskpart(英语:diskpart)

fdisk(英语:fdisk)

format(英语:Format (command))

label(英语:label (command))

subst(英语:SUBST)

scandisk

sys(英语:SYS (command))

vol(英语:vol (command))

vssadmin

进程

exit

kill

powercfg(英语:powercfg)

runas

sc

shutdown

start(英语:start (command))

taskkill

tasklist(英语:tasklist)

注册表

assoc

ftype(英语:ftype)

reg

regini

Regsvr32

用户环境

date

mode

path

set

setx

time(英语:TIME (command))

title

ver(英语:ver (command))

Whoami

文件内容

comp(英语:comp (command))

edit(英语:MS-DOS Editor)

edlin(英语:edlin)

fc(英语:Microsoft File Compare)

find(英语:find (command))

findstr

print(英语:PRINT (command))

type(英语:TYPE (DOS command))

脚本

choice(英语:choice (command))

clip

cscript

doskey(英语:DOSKEY)

echo

for

Goto

if

more

pause

prompt(英语:Command-line_interface#Command_prompt)

rem

网络

arp

getmac

hostname

ipconfig

net use(英语:net use)

netsh

netstat

nslookup

Pathping

ping

route

tracert

维护

driverquery(英语:driverquery)

msiexec

ntbackup

sfc

systeminfo

w32tm(英语:w32tm)

WBAdmin(英语:WBAdmin)

winsat

wmic

启动管理

bcdedit

bootcfg

fixboot

fixmbr

软件开发

debug(英语:debug (command))

exe2bin

QBASIC

杂项

cls

help(英语:help (command))

MS-DOS命令列表

环境变量

相关推荐

正规挣钱最快的游戏(悄悄告诉你赚钱游戏哪个赚钱多又快)
365网络科技有限公司是做什么的

正规挣钱最快的游戏(悄悄告诉你赚钱游戏哪个赚钱多又快)

📅 07-08 👁️ 3202
美记:阿米奴将代表尼日利亚出战世预赛
365网络科技有限公司是做什么的

美记:阿米奴将代表尼日利亚出战世预赛

📅 07-06 👁️ 7585
THE7 主题怎么样?WordPress The7主题功能介绍
365网络科技有限公司是做什么的

THE7 主题怎么样?WordPress The7主题功能介绍

📅 06-28 👁️ 7793
尼康d40x相机价格(2手尼康D40X相机多少钱)
365体育投注下载

尼康d40x相机价格(2手尼康D40X相机多少钱)

📅 07-10 👁️ 7842
舛盭的解释及意思
365体育投注下载

舛盭的解释及意思

📅 06-30 👁️ 3918