cmd命令和dos命令_在Windows MS-DOS命令行教程中,带有示例的CMD / C是什么意思?

cmd命令和dos命令

cmd命令和dos命令

MS-DOS is an operating system and shell used to run commands and provide a command-line interface in Windows operating systems. cmd.exe is used to interpret and provide a console for the MS-DOS command. cmd.exe provides different options where cmd /c is a popular one. cmd /c is used to run commands in MS-DOS and terminate after command or process completion.

MS-DOS是用于在Windows操作系统中运行命令并提供命令行界面的操作系统和外壳程序。 cmd.exe用于解释和提供MS-DOS命令的控制台。 cmd.exe提供了不同的选项,其中cmd /c是流行的选项。 cmd /c用于在MS-DOS中运行命令,并在命令或进程完成后终止。

运行命令并使用CMD / C终止 (Run Command and Terminate with CMD /C)

We can run commands in MS-DOS or in cmd.exe by using cmd /c. We will also add the command string we want to run. For example, if we want to run ping poftut.com we will issue the following command. The command will create a process that will run command and then terminate after the command execution is completed. Also using ” double quotes in order to surround command are very useful.

我们可以使用cmd /c在MS-DOS或cmd.exe运行命令。 我们还将添加要运行的命令字符串。 例如,如果我们想运行ping poftut.com,我们将发出以下命令。 该命令将创建一个将运行命令的进程,然后在命令执行完成后终止。 另外,使用“双引号将命令括起来也是非常有用的。

> cmd /c "ping poftut.com"
Run Command and Terminate with CMD /C
Run Command and Terminate with CMD /C
运行命令并使用CMD / C终止

运行命令并以CMD / C运行命令提示符终止(Run Command and Terminate with CMD /C On-Run Command Prompt)

We can run cmd /c and related commands from the Run Command prompt. We can open Run Command Prompt from the Start menu or with the Windows Key+R key combination and write the cmd /c "ping poftut.com" command like below. Keep in mind that after the execution of the command is completed the MS-DOS windows will be terminated or closed automatically.

我们可以从“运行命令”提示符下运行cmd /c和相关命令。 我们可以从“开始”菜单或使用Windows Key + R组合键打开“运行命令提示符”,然后编写cmd /c "ping poftut.com"命令,如下所示。 请记住,命令执行完成后,MS-DOS窗口将自动终止或关闭。

Run Command and Terminate with CMD /C On Run Command Prompt
Run Command and Terminate with CMD /C On Run Command Prompt
运行命令并以CMD / C终止运行命令提示符

在搜索提示或搜索框上运行命令并以CMD / C终止(Run Command and Terminate with CMD /C On Search Prompt or Box)

Another alternative to run commands with the cmd /c we can use Search Prompt or Box. We will click to the Start Menu and write down the complete command. This will also show the command with the MS-DOS icon like below. This will work like previous examples.

使用cmd /c运行命令的另一种方法是我们可以使用搜索提示或Box。 我们将单击“开始”菜单并写下完整的命令。 这还将显示带有MS-DOS图标的命令,如下所示。 这将像前面的示例一样工作。

Run Command and Terminate with CMD /C On Search Prompt or Box
Run Command and Terminate with CMD /C On Search Prompt or Box
在搜索提示或搜索框上运行命令并以CMD / C终止

运行命令并以CMD / C运行命令提示符终止(Run Command and Terminate with CMD /C On-Run Command Prompt)

Alternatively, we can run cmd /c command from a regular command line or MS-DOS. This will open a new MS-DOS shell and run given command. After the command execution is over the newly created MS-DOS shell will be terminated or closed automatically.

或者,我们可以从常规命令行或MS-DOS运行cmd /c命令。 这将打开一个新的MS-DOS shell并运行给定命令。 在命令执行结束后,新创建的MS-DOS shell将被终止或自动关闭。

> cmd /c "ping poftut.com"
Run Command and Terminate with CMD /C On Run Command Prompt
Run Command and Terminate with CMD /C On Run Command Prompt
运行命令并以CMD / C终止运行命令提示符

运行多个命令(Run Multiple Commands)

We can run multiple commands with the cmd /c. We just need to provides them in double-quotes by separating them with space. In this example, we will run ping poftut.com, ping google.commkdir test in the following example.

我们可以使用cmd /c运行多个命令。 我们只需要通过用空格将它们分开来提供双引号即可。 在此示例中,我们将在以下示例中运行ping poftut.comping google.commkdir test

> cmd /c "ping poftut.com" "ping google.com" "mkdir test"

运行蝙蝠文件并终止 (Run Bat File and Terminate)

Bat or batch files are used to run multiple commands from a file. This will make recurring tasks easier. We can run a bat file by providing its path and name to the cmd /c like below. In this example, we will run the batch file backup.bat

Bat或批处理文件用于从文件运行多个命令。 这将使重复任务变得更容易。 我们可以通过提供cmd /c路径和名称来运行bat文件,如下所示。 在此示例中,我们将运行批处理文件backup.bat

> cmd /c C:\backup.bat

运行命令并使用CMD / K返回到CMD提示符 (Run Command and Return To CMD Prompt with CMD /K)

As stated previously cmd /c will run given the command and terminate a new shell or process after the command is completed. If we do not want to terminate a new process we can use /K option where a newly created process or window will remain without closing.

如前所述, cmd /c将在给定命令的情况下运行,并在命令完成后终止新的Shell或进程。 如果我们不想终止新进程,则可以使用/K选项,其中新创建的进程或窗口将保留而不关闭。

> cmd /k "ping poftut.com"
LEARN MORE  How To Pause and Resume Powershell and Cmd Scripts In Windows With Examples?
了解更多信息如何通过示例在Windows中暂停和恢复Powershell和Cmd脚本?

翻译自: https://www.poftut.com/what-does-cmd-c-means-in-windows-msdos-commandline-tutorial-with-examples/

cmd命令和dos命令

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值