Windows 命令Windows Commands

所有受支持的版本的 Windows (服务器和客户端) 具有一组内置的 Win32 控制台命令。All supported versions of Windows (server and client) have a set of Win32 console commands built in.

此系列文档介绍可用于通过使用脚本或脚本工具自动执行任务的 Windows 命令。This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.

若要在以下 A 到 Z 菜单中查找有关特定命令的信息,请单击该命令开头的字母,然后单击命令名称。To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

一个 | B | C | D | E | F | G | H | | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X |Y |ZA | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z


此 PDF 中包含的信息适用于:The information that is contained in this PDF applies to:

  • Windows Server 2019Windows Server 2019
  • Windows Server(半年频道)Windows Server (Semi-Annual Channel)
  • Windows Server 2016Windows Server 2016
  • Windows Server 2012 R2Windows Server 2012 R2
  • Windows Server 2012Windows Server 2012
  • Windows Server 2008 R2Windows Server 2008 R2
  • Windows Server 2008Windows Server 2008
  • Windows 10Windows 10
  • Windows 8.1Windows 8.1

命令行解释器概述Command shell overview

命令行界面已内置到 Windows,若要使用批处理 (.bat) 文件自动执行日常任务,如用户帐户管理或每夜备份,第一个命令行程序。The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. 与 Windows 脚本宿主可以在命令行界面中运行更复杂的脚本。With Windows Script Host you could run more sophisticated scripts in the Command shell. 有关详细信息,请参阅cscriptwscriptFor more information, see cscript or wscript. 可以通过使用脚本不是您可以通过使用用户界面更高效地执行操作。You can perform operations more efficiently by using scripts than you can by using the user interface. 脚本接受命令行中提供的所有命令。Scripts accept all Commands that are available at the command line.

Windows 具有两个命令 shell:命令行界面和PowerShellWindows has two command shells: The Command shell and PowerShell. 每个 shell 是可提供您与操作系统或应用程序,提供用于自动执行 IT 操作的环境之间直接通信的软件程序。Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.

PowerShell 设计为扩展命令行界面的功能,以运行 PowerShell 命令称为 cmdlet。PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlet 是 Windows 命令相似但提供更具扩展性的脚本语言。Cmdlets are similar to Windows Commands but provide a more extensible scripting language. 您可以在 Powershell 中,运行 Windows 命令和 PowerShell cmdlet,但 Windows 命令和不 PowerShell cmdlet 只能运行命令行界面。You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

对于最可靠、 最新 Windows 自动化,我们建议使用 PowerShell 而不 Windows 的命令或 Windows 脚本主机的 Windows 自动化。For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.


此外可以下载并安装PowerShell Core,PowerShell 的开源版本。You can also download and install PowerShell Core, the open source version of PowerShell.


不正确地编辑注册表可能会对系统造成严重损坏。Incorrectly editing the registry may severely damage your system. 对注册表进行以下更改之前, 应备份计算机上任何有价值的数据。Before making the following changes to the registry, you should back up any valued data on the computer.


若要启用或禁用文件和目录名称中的完成命令行界面上计算机或用户的登录会话,运行regedit.exe并设置以下reg_DWOrd 值:To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\completionChar\reg_DWOrdHKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\completionChar\reg_DWOrd

若要设置reg_DWOrd值,请使用特定函数的控制字符的十六进制值 (例如, 0 9选项卡和0 08是退格符)。To set the reg_DWOrd value, use the hexadecimal value of a control character for a particular function (for example, 0 9 is Tab and 0 08 is Backspace). 用户指定的设置优先于计算机设置和命令行选项优先于注册表设置。User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

命令行参考 A-ZCommand-line reference A-Z

若要了解特定的 Windows 命令,以下 A 到 Z 菜单中,单击命令开头的字母,然后单击命令名称。To find information about a specific Windows Command, in the following A-Z menu, click the letter that the Command starts with, and then click the Command name.

一个 | B | C | D | E | F | G | H | | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X |Y |Z)A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z)