Windows provides different system management modes like interactive and batch. Batch management mode is used like running scripts without or little user interaction.

Windows提供了不同的系统管理模式,例如交互式和批处理。 批处理管理模式的使用类似于运行脚本,而无需用户交互或用户交互很少。

批处理文件和扩展名 (Batch File and Extension)

Batch files are text files which contains MSDOS and Windows commands and tools. Batch files generally uses bat or cmd extensions.But other extensions can be used as long as they will run as batch file with cmd.exe .We can run a batch file without extension or different extension with cmd.exe . In this example we will run a batch file named mybatchfile.txt

批处理文件是包含MSDOS和Windows命令和工具的文本文件。 批处理文件一般采用batcmd extensions.But其他扩展可以,只要他们将运行与批处理文件中使用cmd.exe 。我们可以运行不带扩展名或不同的扩展名与批处理文件cmd.exe 。 在此示例中,我们将运行一个名为mybatchfile.txt的批处理文件。

$ cmd.exe mybatchfile.txt

ASSOC –关联文件类型 (ASSOC – Associate File Type)

We can use ASSOC command in order to find a file type and detailed explanation with this command. We will provide the extension like .txt into the ASSOC command like below.

我们可以使用ASSOC命令来查找文件类型和此命令的详细说明。 我们将在以下的ASSOC命令中提供.txt之类的扩展名。

ASSOC ".exe"

ASSOC – Associate File Type
ASSOC –关联文件类型

As we can see from output that .exe extension is associated with executable file .

从输出中可以看到, .exe扩展名与可执行文件相关联。

If we do not provide a parameter ASSOC will list all existing associations with related extensions.

如果我们不提供参数,则ASSOC将列出所有具有相关扩展名的现有关联。

ASSOC

ATTRIB-列表文件属性 (ATTRIB- List File Attributes)

ATTRIB command is used to list, display and change file attributes about files, folders and directories.

ATTRIB命令用于列出,显示和更改有关文件,文件夹和目录的文件属性。

列表属性 (List Attributes)

We can list given file or folder attributes like below.

我们可以像下面列出给定的文件或文件夹属性。

attrib msdia80.dll

List Attributes
列表属性

更改为只读(Change To Read Only)

We can change the file attribute to read only which will made given file uneditable.

我们可以将文件属性更改为只读,这会使给定的文件不可编辑。

attrib +r msdia80.dll

隐藏 (Make Hidden)

If we want to make to hidden the file we will use +ah option. This will made file hidden from regular user files and folders.

如果我们想隐藏文件,我们将使用+ah选项。 这将使文件从常规用户文件和文件夹中隐藏。

attrib +ah msdia80.dll

删除只读属性 (Remove Read Only Attribute)

After setting some attributed we can remote these attributes later. We will use - sign to remove specified attribute. In this example we will remove read only attribute with the -r option like below.

设置一些属性后,我们可以在以后远程访问这些属性。 我们将使用-符号删除指定的属性。 在此示例中,我们将使用-r选项删除只读属性,如下所示。

attrib -r msdia80.dll

CD –更改当前工作目录 (CD – Change Current Working Directory)

CD will provide very useful feature where we can change given working directory. We can also provide multi level paths to change.

CD将提供非常有用的功能,我们可以在其中更改给定的工作目录。 我们还可以提供多级更改路径。

更改为给定的子目录 (Change To Given Child Directory)

We will start by changing given child directory. We will first use DIR to list directories.

我们将从更改给定的子目录开始。 我们将首先使用DIR列出目录。

cd Users

Change To Given Child Directory
更改为给定的子目录

转到父目录(Change To Parent Directory)

We can use .. as specify parent directory. We can go upper level directory or parent directory with the following command.

我们可以使用..作为指定父目录。 我们可以使用以下命令进入上一级目录或上级目录。

cd ..

更改驱动器或分区 (Change Drive or Partition)

We can also change the current partition. We will change to the drive :d in this example.

我们还可以更改当前分区。 在本示例中,我们将更改为drive :d

cd d:

CHKDSK –检查磁盘和文件系统一致性 (CHKDSK – Check Disk and File System Consistency)

CHKDSK command can be used to check and repair disk and file systems. We can simply use it like below.

CHKDSK命令可用于检查和修复磁盘和文件系统。 我们可以像下面这样简单地使用它。

chkdsk

Windows Chkdsk Utility Tutorial with Examples To Fix File System Errors

Windows Chkdsk实用程序教程,带有修复文件系统错误的示例

CHOICE – Provide List Of Options

选择–提供选项列表

If we need to get input from the user with provided choice we can use CHOICE command like below. We will provide Yes or No like below.

如果需要使用提供的选项从用户那里获取输入,则可以使用如下所示的CHOICE命令。 我们将提供“是”或“否”,如下所示。

ECHO You want tea?CHOISE /c YN /m "Yes or No"

CLS-清除屏幕 (CLS- Clear The Screen)

After some work and operation there will be a lot of option on the console or screen. We can clean this console or screen with the CLS command.

经过一些工作和操作后,控制台或屏幕上将有很多选项。 我们可以使用CLS命令清理此控制台或屏幕。

CLS

CMD –调用新命令提示符 (CMD – Invoke New Command Prompt)

If we want to create new or child command prompt we can use CMD which will call cmd.exe application.

如果要创建新命令或子命令提示符,可以使用CMD来调用cmd.exe应用程序。

CMD

COMP –比较两个文件大小 (COMP – Compare Two Files Sizes)

If we have some some files and we want  to compare their sizes we can use COMP command. We will provide two paramers those will be the file names. In this example we will compare files named a.txt and b.txt

如果我们有一些文件,并且想比较它们的大小,可以使用COMP命令。 我们将提供两个参数,它们将是文件名。 在此示例中,我们将比较名为a.txtb.txt文件

COMP a.txt b.txt

转换–转换文件系统类型 (CONVERT – Convert File System Type)

This is a bit low level command where we can convert file system of the given partition. In this example we will convert partition D: .

这是一个有点低级的命令,我们可以在其中转换给定分区的文件系统。 在此示例中,我们将转换分区D:

CONVERT D:\

COPY –复制文件 (COPY – Copy Files)

We can copy given file to the destination with the COPY command. In this example we will copy file a.txt to the D: partition.

我们可以使用COPY命令将给定文件复制到目标位置。 在此示例中,我们将文件a.txt复制到D:分区。

COPY c:\a.txt d:\

DATE –显示当前日期 (DATE – Display Current Date)

We can use %DATE% variable which holds the current date. We will print to the console with the echo command.

我们可以使用%DATE%变量来保存当前日期。 我们将使用echo命令打印到控制台。

echo %DATE%

DATE – Display Current Date
DATE –显示当前日期

DEL –删除文件(DEL – Delete Files)

We can delete files with the DEL command. We will provide the name of the file we want to delete.

我们可以使用DEL命令删除文件。 我们将提供我们要删除的文件的名称。

.u50925981c17cdcef4ee5c423586ed487 , .u50925981c17cdcef4ee5c423586ed487 .postImageUrl , .u50925981c17cdcef4ee5c423586ed487 .centered-text-area { min-height: 80px; position: relative; } .u50925981c17cdcef4ee5c423586ed487 , .u50925981c17cdcef4ee5c423586ed487:hover , .u50925981c17cdcef4ee5c423586ed487:visited , .u50925981c17cdcef4ee5c423586ed487:active { border:0!important; } .u50925981c17cdcef4ee5c423586ed487 .clearfix:after { content: ""; display: table; clear: both; } .u50925981c17cdcef4ee5c423586ed487 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u50925981c17cdcef4ee5c423586ed487:active , .u50925981c17cdcef4ee5c423586ed487:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u50925981c17cdcef4ee5c423586ed487 .centered-text-area { width: 100%; position: relative; } .u50925981c17cdcef4ee5c423586ed487 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u50925981c17cdcef4ee5c423586ed487 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u50925981c17cdcef4ee5c423586ed487 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u50925981c17cdcef4ee5c423586ed487:hover .ctaButton { background-color: #E67E22!important; } .u50925981c17cdcef4ee5c423586ed487 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u50925981c17cdcef4ee5c423586ed487 .u50925981c17cdcef4ee5c423586ed487-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u50925981c17cdcef4ee5c423586ed487:after { content: ""; display: block; clear: both; }

LEARN MORE  What Is Command Line and Command Prompt In Windows Operating System?

.u50925981c17cdcef4ee5c423586ed487 , .u50925981c17cdcef4ee5c423586ed487 .postImageUrl , .u50925981c17cdcef4ee5c423586ed487 .centered-text-area { min-height: 80px; position: relative; } .u50925981c17cdcef4ee5c423586ed487 , .u50925981c17cdcef4ee5c423586ed487:hover , .u50925981c17cdcef4ee5c423586ed487:visited , .u50925981c17cdcef4ee5c423586ed487:active { border:0!important; } .u50925981c17cdcef4ee5c423586ed487 .clearfix:after { content: ""; display: table; clear: both; } .u50925981c17cdcef4ee5c423586ed487 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u50925981c17cdcef4ee5c423586ed487:active , .u50925981c17cdcef4ee5c423586ed487:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u50925981c17cdcef4ee5c423586ed487 .centered-text-area { width: 100%; position: relative; } .u50925981c17cdcef4ee5c423586ed487 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u50925981c17cdcef4ee5c423586ed487 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u50925981c17cdcef4ee5c423586ed487 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u50925981c17cdcef4ee5c423586ed487:hover .ctaButton { background-color: #E67E22!important; } .u50925981c17cdcef4ee5c423586ed487 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u50925981c17cdcef4ee5c423586ed487 .u50925981c17cdcef4ee5c423586ed487-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u50925981c17cdcef4ee5c423586ed487:after { content: ""; display: block; clear: both; }

了解更多信息Windows操作系统中的命令行和命令提示符是什么?

删除给定文件 (Delete Given File)

We will delete file named a.txt

我们将删除名为a.txt文件

DEL a.txt

删除给定扩展名 (Delete Given Extension)

We can also delete for specific extension. For example we can delete text files those generally have .txt extension with the following command.

我们也可以删除特定扩展名。 例如,我们可以使用以下命令删除扩展名通常为.txt文本文件。

DEL *.txt

删除文件前询问 (Ask Before Delete File)

If we will delete in bulk confirmation will help us. We can  use /p option which will enable confirmation before each file deletion.

如果我们将批量删除,确认将对我们有帮助。 我们可以使用/p选项,该选项将在每个文件删除之前启用确认。

DEL /p *.txt

DIR –列出文件和文件夹 (DIR – List File and Folders)

We can list current working and given directory files and folders with the DIR command like below.

我们可以使用DIR命令列出当前工作目录和给定目录文件和文件夹,如下所示。

列出所有文件和文件夹 (List All Files and Folders)

We can use DIR without any option to list all files and folders for the current working directory

我们可以不带任何选项使用DIR列出当前工作目录的所有文件和文件夹

DIR

List All Files and Folders
列出所有文件和文件夹

列出隐藏的文件和文件夹(List Hidden Files and Folders)

By default hidden files and folders do not listed. But we can list hidden files and folders with the /ah option like below.

默认情况下,未列出隐藏的文件和文件夹。 但是我们可以使用/ah选项列出隐藏的文件和文件夹,如下所示。

DIR /ah

List Hidden Files and Folders
列出隐藏的文件和文件夹

列出特定的扩展文件(List Specific Extension Files)

We can list specific extension by providing the extension to the DIR command. In this example we will list extension with *.php

我们可以通过提供DIR命令的扩展名来列出特定的扩展名。 在此示例中,我们将列出带有*.php扩展名

dir "*.php"

DISKPART –显示和更改磁盘分区和属性 (DISKPART – Show and Change Disk Partition and Properties)

We can use DISKPART command in order to list, display and change disk partition properties.

我们可以使用DISKPART命令来列出,显示和更改磁盘分区属性。

DISKPART

Windows Diskpart Command Tutorial with Examples To Format Disk

Windows Diskpart命令教程,包括格式化磁盘的示例

DRIVERQUERY –列出驱动程序和属性(DRIVERQUERY – List Drivers and Properties)

We can use DRIVERQUERY in order to list installed device drivers and related properties with dates.

我们可以使用DRIVERQUERY来列出已安装的设备驱动程序和相关属性以及日期。

DRIVERQUERY

DRIVERQUERY – List Drivers and Properties
DRIVERQUERY –列出驱动程序和属性

ECHO –打印到控制台(ECHO – Print To The Console)

ECHO command is used to print to the console or standard output. We can also use this command in order to print environment variables or given strings.

ECHO命令用于打印到控制台或标准输出。 我们也可以使用此命令来打印环境变量或给定的字符串。

打印给定的字符串 (Print Given String)

We will print given string which is "Hello World" in this case.

在这种情况下,我们将打印给定的字符串"Hello World"

ECHO "Hello World"

打印环境变量 (Print Environment Variable)

We can print given environment variable like %DATE% in this case

在这种情况下,我们可以打印给定的环境变量,例如%DATE%

echo %DATE%

退出–终止并退出控制台 (EXIT – Terminate and Exit From Console)

We can use EXIT in order to terminate current console and exit. This will also end current script too.

我们可以使用EXIT来终止当前控制台并退出。 这也将结束当前脚本。

EXIT

FC –区分两个文件 (FC – Diff Two Files)

We can compare two files and print differencies with the FC command. We will provide two files named a.txt and b.txt in this example.

我们可以比较两个文件并使用FC命令打印差异。 在此示例中,我们将提供两个名为a.txtb.txt文件。

FC a.txt b.txt

查找–在文件中搜索给定的字符串 (FIND – Search Given String In A File)

We can use FIND command to search for given string in a given file. In this example we will search for test in file named a.txt.

我们可以使用FIND命令在给定文件中搜索给定字符串。 在此示例中,我们将在名为a.txt文件中搜索test

FIND "test" a.txt

格式-更改文件系统 (FORMAT – Change File System)

Another command to change File System is FORMAT command. We will also provide the partition we want to format.

更改文件系统的另一个命令是FORMAT命令。 我们还将提供要格式化的分区。

FORMAT F:\

帮助–显示帮助信息 (HELP – Display Help Information)

While using batch commands we may need to get help for general or specific command. We can use  HELP command which will display available commands provided by MSDOS.

使用批处理命令时,我们可能需要获得常规或特定命令的帮助。 我们可以使用HELP命令,它将显示MSDOS提供的可用命令。

.u57a5b72d63a364e660f8291b46e8603c , .u57a5b72d63a364e660f8291b46e8603c .postImageUrl , .u57a5b72d63a364e660f8291b46e8603c .centered-text-area { min-height: 80px; position: relative; } .u57a5b72d63a364e660f8291b46e8603c , .u57a5b72d63a364e660f8291b46e8603c:hover , .u57a5b72d63a364e660f8291b46e8603c:visited , .u57a5b72d63a364e660f8291b46e8603c:active { border:0!important; } .u57a5b72d63a364e660f8291b46e8603c .clearfix:after { content: ""; display: table; clear: both; } .u57a5b72d63a364e660f8291b46e8603c { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u57a5b72d63a364e660f8291b46e8603c:active , .u57a5b72d63a364e660f8291b46e8603c:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u57a5b72d63a364e660f8291b46e8603c .centered-text-area { width: 100%; position: relative; } .u57a5b72d63a364e660f8291b46e8603c .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u57a5b72d63a364e660f8291b46e8603c .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u57a5b72d63a364e660f8291b46e8603c .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u57a5b72d63a364e660f8291b46e8603c:hover .ctaButton { background-color: #E67E22!important; } .u57a5b72d63a364e660f8291b46e8603c .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u57a5b72d63a364e660f8291b46e8603c .u57a5b72d63a364e660f8291b46e8603c-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u57a5b72d63a364e660f8291b46e8603c:after { content: ""; display: block; clear: both; }

LEARN MORE  How To Start Applications From Command Line In Windows Different Ways?

.u57a5b72d63a364e660f8291b46e8603c , .u57a5b72d63a364e660f8291b46e8603c .postImageUrl , .u57a5b72d63a364e660f8291b46e8603c .centered-text-area { min-height: 80px; position: relative; } .u57a5b72d63a364e660f8291b46e8603c , .u57a5b72d63a364e660f8291b46e8603c:hover , .u57a5b72d63a364e660f8291b46e8603c:visited , .u57a5b72d63a364e660f8291b46e8603c:active { border:0!important; } .u57a5b72d63a364e660f8291b46e8603c .clearfix:after { content: ""; display: table; clear: both; } .u57a5b72d63a364e660f8291b46e8603c { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u57a5b72d63a364e660f8291b46e8603c:active , .u57a5b72d63a364e660f8291b46e8603c:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u57a5b72d63a364e660f8291b46e8603c .centered-text-area { width: 100%; position: relative; } .u57a5b72d63a364e660f8291b46e8603c .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u57a5b72d63a364e660f8291b46e8603c .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u57a5b72d63a364e660f8291b46e8603c .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u57a5b72d63a364e660f8291b46e8603c:hover .ctaButton { background-color: #E67E22!important; } .u57a5b72d63a364e660f8291b46e8603c .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u57a5b72d63a364e660f8291b46e8603c .u57a5b72d63a364e660f8291b46e8603c-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u57a5b72d63a364e660f8291b46e8603c:after { content: ""; display: block; clear: both; }

了解更多信息如何以Windows的不同方式从命令行启动应用程序?

列出所有命令 (List All Command)

Without any option we can list all commands provided by MSDOS with HELP command like below.

没有任何选择,我们可以列出MSDOS提供的所有命令以及如下的HELP命令。

HELP

List All Command
列出所有命令

帮助特定命令(Help For Specific Command)

We can get detailed information about a MSDOS command by providing the command after HELP. In this example we will list information about DIR command.

通过在HELP之后提供命令,我们可以获得有关MSDOS命令的详细信息。 在此示例中,我们将列出有关DIR命令的信息。

HELP dir

Help For Specific Command
帮助特定命令

IPCONFIG –列出网络配置,如IP地址(IPCONFIG – List Network Configuration Like IP Address)

IPCONFIG will list information about the current system network interfaces and IP configuration.

IPCONFIG将列出有关当前系统网络接口和IP配置的信息。

IPCONFIG

IPCONFIG – List Network Configuration Like IP Address
IPCONFIG –列出网络配置,如IP地址

Windows Ipconfig Command Tutorial With Examples To List, Change, Renew IP Configuration

Windows Ipconfig命令教程,包括列出,更改,续订IP配置的示例

标签–添加,设置或删除磁盘标签(LABEL – Add, Set or Remove Disk Labels)

Disks are labeled for easy of management. We can use LABEL command in order to change or remove disk labels.

磁盘被标记为易于管理。 我们可以使用LABEL命令来更改或删除磁盘标签。

LABEL D:\

LABEL – Add, Set or Remove Disk Labels
标签–添加,设置或删除磁盘标签

MD –创建新目录(MD – Create New Directory)

We can use MD command in order to create new directory or folder. In this example we will create a folder named BACKUP.

我们可以使用MD命令来创建新目录或文件夹。 在此示例中,我们将创建一个名为BACKUP的文件夹。

MD BACKUP

更多–阅读文件内容 (MORE – Read File Contents)

We can read a file content with the MORE command. Especially text files can be printed from command line. We will also provide the file name to this command.

我们可以使用MORE命令读取文件内容。 特别是文本文件可以从命令行打印。 我们还将提供此命令的文件名。

MORE abc.txt

移动–移动文件和文件夹 (MOVE – Move Files and Folders)

We can use MOVE command in order to move files and folders. This command can be also used to rename files and folders.

我们可以使用MOVE命令来移动文件和文件夹。 此命令还可用于重命名文件和文件夹。

MOVE c:\abc.txt d:\xyz.txt

NET –管理Windows网络服务 (NET – Manage Windows Network Services)

Windows operating system provides a lot of network related options for their operating system and services. We can use NET command with the following features.

Windows操作系统为其操作系统和服务提供了许多与网络相关的选项。 我们可以使用具有以下功能的NET命令。

  • net accounts净账户
  • net computer网络计算机
  • net config网络配置
  • net continue净继续
  • net file网络文件
  • net group网组
  • net help网络帮助
  • net name网名
  • net pause净暂停
  • net print净印刷
  • net send净发送
  • net session净会话
  • net share净份额
  • net start净启动
  • net statistics净统计
  • net stop净止损
  • net time净时间
  • net use净使用
  • net view净视图

How To Use Net Use Command In Windows Command Line?

如何在Windows命令行中使用Net Use命令?

PATH –显示路径变量 (PATH  – Display Path Variable)

PATH variable provides commands and applications to run. We can list these paths with the PATH variable.

PATH变量提供要运行的命令和应用程序。 我们可以使用PATH变量列出这些路径。

echo %PATH%

PATH  – Display Path Variable
PATH –显示路径变量

暂停–停止当前正在运行的脚本(PAUSE – Stop Current Running Script)

If we want to stop a script output we can use PAUSE command. This will stop script up to pressing a key for the console.

如果要停止脚本输出,可以使用PAUSE命令。 这将停止脚本,直到按控制台的键为止。

PAUSE

PING –测试远程主机 (PING – Test Remote Hosts)

PING command can be used to test remote system connectivity. We will also provide the IP address or host name of the remote system. It will send 4 time and ICMP package for test.

PING命令可用于测试远程系统连接。 我们还将提供远程系统的IP地址或主机名。 它将发送4时间和ICMP包进行测试。

PING google.com

PING – Test Remote Hosts
PING –测试远程主机

RD –删除空目录(RD – Remove Empty Directories)

We can use RD command in order to remove empty directory. This will not work for non-empty directories. We will remove directory named ABC.

我们可以使用RD命令来删除空目录。 这不适用于非空目录。 我们将删除名为ABC目录。

RD ABC

REM –在批处理文件中添加注释 (REM – Add Comment To The Batch File)

We may need to put some comments about the script file. We will use REM in order to add comments. All lines starting with the REM will interpreted as comment.

我们可能需要对脚本文件添加一些注释。 我们将使用REM来添加评论。 以REM开头的所有行将被解释为注释。

REM This is a comment no command :)

REN –重命名文件和目录 (REN – Rename File and Directories)

We can rename files and directories with the REN command. We will provide current name and new name. In this example we will rename file abc.txt to the 123.txt

我们可以使用REN命令重命名文件和目录。 我们将提供当前名称和新名称。 在此示例中,我们将文件abc.txt重命名为123.txt

REN abc.txt 123.txt

SET –显示环境变量 (SET – Display Environment Variables)

We can list current environment variables with the SET command.

我们可以使用SET命令列出当前的环境变量。

SET

SET – Display Environment Variables
SET –显示环境变量

关机–关闭系统(SHUTDOWN – Shutdown the System)

We can shutdown the system with the SHUTDOWN command like below.

我们可以使用SHUTDOWN命令关闭系统,如下所示。

SHUTDOWN

SORT –对文件内容进行排序 (SORT – Sort Content Of A File)

We can sort given file content and print to the console with the SORT command like below. In this example we will sort and print file named abc.txt

我们可以对给定的文件内容进行排序,并使用SORT命令将其打印到控制台,如下所示。 在此示例中,我们将排序并打印名为abc.txt文件

SORT abc.txt

开始–启动新程序 (START – Start New Program)

We can use START command by providing and exe or a batch file to start. In this example we will start the application named notepad.exe

我们可以通过提供START命令和exe或批处理文件来启动。 在此示例中,我们将启动名为notepad.exe的应用程序

START notepad.exe

SYSTEMINFO –显示计算机和操作系统信息 (SYSTEMINFO – Display Computer and Operating System Information)

We can use SYSTEMINFO in order to list and display computer, operating system and software information.

我们可以使用SYSTEMINFO来列出和显示计算机,操作系统和软件信息。

SYSTEMINFO

SYSTEMINFO – Display Computer and Operating System Information
SYSTEMINFO –显示计算机和操作系统信息

How To Open System Information Panel On Windows To Check Computer and Specification?

如何在Windows上打开系统信息面板以检查计算机和规格?

任务杀死–杀死任务和过程 (TASKKILL – Kill Task and Process)

Processes can be killed in different ways. We can use TASKKILL command in order to end given process. In this example we will ill task or process named notepad.exe

可以用不同的方式杀死进程。 我们可以使用TASKKILL命令来结束给定的过程。 在此示例中,我们将使名为notepad.exe任务或进程notepad.exe

TASKKILL /im notepad.exe

任务列表–列出当前任务或过程 (TASKLIST – List Current Tasks or Processes)

We can list currently running tasks and processes with the TASKLIST command.

我们可以使用TASKLIST命令列出当前正在运行的任务和流程。

TASKLIST

TASKLIST – List Current Tasks or Processes
任务列表–列出当前任务或过程

TIME –显示或设置当前时间(TIME – Display or Set Current Time)

We can use TIME command in order to display or set current time of the system. We will use %TIME% variable like below.

我们可以使用TIME命令来显示或设置系统的当前时间。 我们将使用%TIME%变量,如下所示。

echo %TIME%

TIME – Display or Set Current Time
TIME –显示或设置当前时间

标题-设置MSDOS控制台的标题(TITLE – Set Title Of MSDOS Console)

We can set the title of the currently running MSDOS console with the TITLE command. In this example we will set the console title as MYCONSOLE

我们可以使用TITLE命令设置当前正在运行的MSDOS控制台的TITLE 。 在此示例中,我们将控制台标题设置为MYCONSOLE

TITLE MYCONSOLE

TREE –将子目录显示为树 (TREE – Display Subdirectories As Tree)

We can list current directory child or subdirectories with the TREE command. It will provide very useful output for investigating folder hierarchy.

我们可以使用TREE命令列出当前目录的子目录或子目录。 这将为调查文件夹层次结构提供非常有用的输出。

TREE

TREE – Display Subdirectories As Tree
TREE –将子目录显示为树

VER –显示Windows或MSDOS版本(VER – Display Windows or MSDOS Version)

Windows operating systems and MSDOS have different versions. We can display current operating system and MSDOS version with the  VERcommand like below.

Windows操作系统和MSDOS具有不同的版本。 我们可以使用VER命令显示当前的操作系统和MSDOS版本,如下所示。

VER

VER – Display Windows or MSDOS Version
VER –显示Windows或MSDOS版本

VOL –显示音量标签(VOL  – Display Volume Label)

We can displat current volume label with the VOL command.

我们可以使用VOL命令显示当前的音量标签。

VOL

XCOPY –复制文件和文件夹 (XCOPY – Copy Files and Folders)

XCOPY command can be used to copy files and folders. We will provide the source and destination files and folders. In this example file abc.txt to the 123.txt

XCOPY命令可用于复制文件和文件夹。 我们将提供源和目标文件和文件夹。 在此示例文件abc.txt123.txt

XCOPY abc.txt 123.txt

Windows Copy Operation With Xcopy Command Tutorial With Examples

带有示例的Xcopy命令教程的Windows复制操作

.u8b13248ee61fc6e5f15074289c829dbe , .u8b13248ee61fc6e5f15074289c829dbe .postImageUrl , .u8b13248ee61fc6e5f15074289c829dbe .centered-text-area { min-height: 80px; position: relative; } .u8b13248ee61fc6e5f15074289c829dbe , .u8b13248ee61fc6e5f15074289c829dbe:hover , .u8b13248ee61fc6e5f15074289c829dbe:visited , .u8b13248ee61fc6e5f15074289c829dbe:active { border:0!important; } .u8b13248ee61fc6e5f15074289c829dbe .clearfix:after { content: ""; display: table; clear: both; } .u8b13248ee61fc6e5f15074289c829dbe { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u8b13248ee61fc6e5f15074289c829dbe:active , .u8b13248ee61fc6e5f15074289c829dbe:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u8b13248ee61fc6e5f15074289c829dbe .centered-text-area { width: 100%; position: relative; } .u8b13248ee61fc6e5f15074289c829dbe .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u8b13248ee61fc6e5f15074289c829dbe .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u8b13248ee61fc6e5f15074289c829dbe .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u8b13248ee61fc6e5f15074289c829dbe:hover .ctaButton { background-color: #E67E22!important; } .u8b13248ee61fc6e5f15074289c829dbe .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u8b13248ee61fc6e5f15074289c829dbe .u8b13248ee61fc6e5f15074289c829dbe-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u8b13248ee61fc6e5f15074289c829dbe:after { content: ""; display: block; clear: both; }

LEARN MORE  What Is Command Line and Command Prompt In Windows Operating System?

.u8b13248ee61fc6e5f15074289c829dbe , .u8b13248ee61fc6e5f15074289c829dbe .postImageUrl , .u8b13248ee61fc6e5f15074289c829dbe .centered-text-area { min-height: 80px; position: relative; } .u8b13248ee61fc6e5f15074289c829dbe , .u8b13248ee61fc6e5f15074289c829dbe:hover , .u8b13248ee61fc6e5f15074289c829dbe:visited , .u8b13248ee61fc6e5f15074289c829dbe:active { border:0!important; } .u8b13248ee61fc6e5f15074289c829dbe .clearfix:after { content: ""; display: table; clear: both; } .u8b13248ee61fc6e5f15074289c829dbe { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u8b13248ee61fc6e5f15074289c829dbe:active , .u8b13248ee61fc6e5f15074289c829dbe:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u8b13248ee61fc6e5f15074289c829dbe .centered-text-area { width: 100%; position: relative; } .u8b13248ee61fc6e5f15074289c829dbe .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u8b13248ee61fc6e5f15074289c829dbe .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u8b13248ee61fc6e5f15074289c829dbe .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u8b13248ee61fc6e5f15074289c829dbe:hover .ctaButton { background-color: #E67E22!important; } .u8b13248ee61fc6e5f15074289c829dbe .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u8b13248ee61fc6e5f15074289c829dbe .u8b13248ee61fc6e5f15074289c829dbe-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u8b13248ee61fc6e5f15074289c829dbe:after { content: ""; display: block; clear: both; }

了解更多信息Windows操作系统中的命令行和命令提示符是什么?

翻译自: https://www.poftut.com/batch-file-commands-for-windows-msdos/

Windows MSDOS的批处理文件命令相关推荐

  1. 【开发环境】Java 文件生成 Windows 系统 .bat 批处理文件并自动执行 ( 输出 GB2312 格式处理中文乱码 | \r\n换行 | Runtime 执行 Cmd 命令 )

    文章目录 Java 文件生成 Windows 系统 .bat 批处理文件并自动执行 1.生成 bat 脚本注意事项 2.Java 执行 Cmd 命令 3.完整代码示例 4.执行结果 Java 文件生成 ...

  2. windows xp 系统CMD命令大全

    词条简介 cmd-cmd.exe- 进程 信息 进程 文件 :cmd或者cmd.exe 进程名称:WindowsCommandPrompt 描述: cmd.exe是 微软 Windows 系统 的命令 ...

  3. windows xp 系统CMD命令大全(一)

    词条简介 cmd-cmd.exe- 进程 信息 进程 文件 :cmd或者cmd.exe 进程名称:WindowsCommandPrompt 描述: cmd.exe是 微软 Windows 系统 的命令 ...

  4. 主题:windows xp 系统CMD命令大全(一)

    转自:http://www.docin.com/p-465660.html 词条简介 cmd-cmd.exe- 进程 信息 进程 文件 :cmd或者cmd.exe 进程名称:WindowsComman ...

  5. Windows XP系统总命令集合

    (转)Windows XP系统总命令集合 winver---------检查Windows版本 wmimgmt.msc----打开windows管理体系结构(WMI) wupdmgr--------w ...

  6. windows命令提示符cmd常用命令

    首先,打开"运行"对话框(Win+R),输入cmd,打开控制台命令窗口... { 也可以通过cmd /c 命令 和 cmd /k 命令的方式来直接运行命令 注:/c表示执行完命令后 ...

  7. windows下的cmd命令(全面)

    2019独角兽企业重金招聘Python工程师标准>>> 命令提示符是在操作系统中,提示进行命令输入的一种工作提示符.在不同的操作系统环境下,命令提示符各不相同. 在windows环境 ...

  8. windows的.bat批处理文件运行Python脚本程序

    windows的.bat批处理文件运行Python脚本程序 文章目录: 一.如何创建 `.bat` 批处理文件 二.创建执行的Python脚本程序 一.如何创建 .bat 批处理文件 创建.bat 批 ...

  9. 嵌入式linux 网络唤醒,C语言实现wake on lan(网络唤醒...-Windows系统下用命令行编译C/C++...-字符串常量引起的思考_169IT.COM...

    前一段时间在自学linux系统,想模仿linux命令行的方式在Windows下编译C/C++程序,摸索一段时间后总算把这个解决了! (1)先用记事本编写如下所示的代码,并另存为hello.cpp,假设 ...

  10. windows 中开机自启动命令行(CLI)

    windows 中开机自启动命令行(CLI) English-Version 1. 创建自启动批处理文件 新建一个.txt文档,在里面输入代码 @echo off CMD 然后把文件更名为start. ...

最新文章

  1. 3dmax2014:打开3dmax2014软件时,出现许可证检出失败 错误20
  2. Abp v0.18.0 新版本: MVC Module 启动模板
  3. C语言 文件读写 fputs 函数 - C语言零基础入门教程
  4. 04 理解SQL与T-SQL的概念测试分析 1214
  5. mysql 表级别的锁和行级别的_MySQL 表锁和行锁机制
  6. Spark共享变量(广播变量、累加器)
  7. Virtual Member Functions(虚拟成员函数)
  8. HTML的字体10种酷炫效果
  9. 关于职业规划的座谈会
  10. 百度导航引擎初始化失败问题解决
  11. htc升级鸿蒙,HTC手机卡刷教程,固件升级教程
  12. Xilinx AXI Crossbar相关调试记录
  13. 独家-县域统计年鉴Excel版(2000-2021年)-包含县市及乡镇卷
  14. C++基础 Data类的实现
  15. String以及StringBuffer的基本操作
  16. 视频剪切合并器使用方法,如何使用视频剪切合并器分割合并视频片段
  17. Visual Studio中无法打开源文件
  18. 2021年中国数据中台行业白皮书
  19. flash钢琴简谱转换程序
  20. 让重疾理赔不再困难,支付宝“相互保”2步完成理赔

热门文章

  1. 岩板铺地好吗_铺地的石板如何用处高逼格,三个大师案例来教你!
  2. [渝粤教育] 西南石油大学 普通地质学 参考 资料
  3. Windows win10设置网卡优先级
  4. 如何查看电脑所有连接过的wifi密码?
  5. SYN flooding
  6. myeclipseCI2018.12.0新建web项目目录结构没有webroot
  7. find_calib_object算子说明
  8. 微信调整字体大小 html,H5禁止微信内置浏览器调整字体大小
  9. 如何免费将jpg转换为word可编辑
  10. android网络请求忽略证书,android,_Okhttp3 忽略证书问题,android - phpStudy