大网数据广告活动
Windows排障命令

cd

· 52CE 我爱测

Reference article for the cd command, which displays the name of or changes the current directory.

Displays the name of the current directory or changes the current directory. If used with only a drive letter (for example, cd C:), cd displays the names of the current directory in the specified drive. If used without parameters, cd displays the current drive and directory.

Note: This command is the same as the chdir command.

Syntax

cd [/d] [<drive>:][<path>]
cd [..]
chdir [/d] [<drive>:][<path>]
chdir [..]

Parameters

Parameter Description
/d Changes the current drive as well as the current directory for a drive.
<drive>: Specifies the drive to display or change (if different from the current drive).
<path> Specifies the path to the directory that you want to display or change.
[..] Specifies that you want to change to the parent folder.
/? Displays help at the command prompt.

Remarks

If command extensions are enabled, the following conditions apply to the cd command:

  • The current directory string is converted to use the same case as the names on the disk. For example, cd c:\temp would set the current directory to C:\Temp if that is the case on the disk.

  • Spaces aren't treated as delimiters, so <path> can contain spaces without enclosing quotation marks. For example:

    cd username\programs\start menu
    

    is the same as:

    cd "username\programs\start menu"
    

    If extensions are disabled, the quotation marks are required.

  • To disable command extensions, type:

    cmd /e:off
    

Examples

To return to the root directory, the top of the directory hierarchy for a drive:

cd\

To change the default directory on a drive that is different from the one you are on:

cd [<drive>:[<directory>]]

To verify the change to the directory, type:

cd [<drive>:]

Related links

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 10/16/2017
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。