> DOS 中文参考手册 > cd

CHDIR (CD)

(change directory)


显示当前目录名或改变当前目录。

CHDIR [/D] [盘符][路径]

进入指定盘符下的目录

CHDIR [..]

返回到上级目录

CHDIR \

返回到当前盘符的根目录

CHDIR

不带参数只键入 CHDIR命令,则显示当前驱动器和目录

CD [/D] [盘符][路径]

进入指定盘符下的目录

CD [..]

返回到上级目录

CD \

返回到当前盘符的根目录

[盘符] 

不带CD/CHDIR命令只输入盘符,例如输入 "E: "便直接进入E盘根目录

CD

不带参数只键入 CD命令,则显示当前驱动器和目录

                                                      

使用 /D 命令行开关(MS-DOS中默认为打开),除了改变驱动器的当前目录之外,还可改变当前驱动器。 

如果扩展命令名被启用,CHDIR 会如下改变:

 

1.当前的目录字符串会被转换成使用磁盘名上的大小写。

 

2.CHDIR 命令不把空格当作分隔符,因此有可能将目录名改为一个带有空格但不带有引号的子目录名。例如:

   cd \winnt\profiles\username\programs\start menu

    而在扩展功能停用的情况下,您必须像这样键入命令:

   cd "\winnt\profiles\username\programs\start menu"


Displays the name of or changes the current directory.

CHDIR [/D] [drive:][path]

CHDIR [..]

CD [/D] [drive:][path]

CD [..]

..   Specifies that you want to change to the parent directory.

Type CD drive: to display the current directory in the specified drive.

Type CD without parameters to display the current drive and directory.

Use the /D switch to change current drive in addition to changing current directory for a drive.

If Command Extensions are enabled CHDIR changes as follows:

The current directory string is converted to use the same case asthe on disk names.  So CD C:\TEMP would actually set the current directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, so it is possible to CD into a subdirectory name that contains a space without surrounding the name with quotes.  For example:

    cd \winnt\profiles\username\programs\start menu

is the same as:

    cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.


下一篇: