Windows CMD.exe或带有示例的Command Shell教程

Windows cmd or cmd.exe is standard shell and command line interface for all of the Windows operating system. Currently Powershell is preferred one but cmd is useful and popular too. In this tutorial we will look some features of the cmd.exe aka cmd

Windows cmdcmd.exe是所有Windows操作系统的标准外壳程序和命令行界面。 当前,Powershell是首选,但cmd很有用,也很流行。 在本教程中,我们将查找cmd.exe某些功能,也称为cmd

打开命令行外壳 (Open Command Line Shell)

We can open command shell or cmd in different ways. We can open it from Program Files. But the most practical way is opening with Run prompt. We will write cmd to the run and hit enter.

我们可以通过不同的方式打开命令shell或cmd 。 我们可以从程序文件中打开它。 但是最实用的方法是使用Run提示打开。 我们将cmd写入运行,然后按Enter。

cmd

运行并关闭Cmd (Run and Close Cmd)

We can provide the command we want to run in cmd shell environment with /C option. We will also specify the command we want to run.

我们可以使用/C选项提供要在cmd shell环境中运行的命令。 我们还将指定我们要运行的命令。

In this example we will run dir command and then close cmd

在此示例中,我们将运行dir命令,然后关闭cmd

> cmd /C dir

If we want to see the close effect we can run this command in run

如果要查看关闭效果,可以在run运行此命令

运行并返回Cmd(Run and Return Cmd)

If we need to run command in a new cmd shell and then do not close the cmd in order to see command output we can run /K option.

如果我们需要在新的cmd shell中运行命令,然后不关闭cmd以查看命令输出,则可以运行/K选项。

> cmd /K dir
Run and Return Cmd
Run and Return Cmd
运行并返回Cmd

使用参数运行程序 (Run Program with Parameter)

We generally need to provides parameters to the commands executed by cmd . We can provide these parameters after the command like below. In this example we will provide the file name to the command.

我们通常需要为cmd执行的命令提供参数。 我们可以在如下命令之后提供这些参数。 在此示例中,我们将为命令提供文件名。

> cmd dir "c:\Users"

关闭回音 (Turn Echo Off)

Commands those creates output to the shell will print output the the cmd . We can turn these output off to make things more clear.

那些将输出创建到shell的命令将输出cmd输出。 我们可以关闭这些输出以使情况更清楚。

> cmd /Q dir
LEARN MORE  Batch File Commands For Windows MSDOS
了解更多用于Windows MSDOS的批处理文件命令

翻译自: https://www.poftut.com/windows-cmd-exe-command-shell-tutorial-examples/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值