入门 (Getting started)
Windows, MacOS and Linux have command line interfaces. Windows’ default command line is the command prompt. The command prompt allows users to use their computer without pointing and clicking with a mouse.
Windows,MacOS和Linux具有命令行界面。 Windows的默认命令行是命令提示符。 命令提示符允许用户使用计算机而无需用鼠标指向和单击。
The command prompt is a black screen where users type commands to use their computer. The same tasks that can be done by pointing and clicking with a mouse can also be done with the command prompt. The difference is that many tasks such as creating folders and deleting files can be done faster in the command prompt.
命令提示符是黑屏,用户可以在其中键入命令以使用其计算机。 通过鼠标指向和单击可以完成的相同任务也可以在命令提示符下完成。 区别在于,可以在命令提示符下更快地完成许多任务,例如创建文件夹和删除文件。
Also, it allows users to configure their computer and run programs that they otherwise could not do by pointing and clicking.
此外,它还允许用户通过单击来配置计算机并运行他们原本无法执行的程序。
打开命令提示符 (Opening the Command Prompt)
To access the command prompt, click the windows start menu on the Desktop tool bar (you can also press the windows button on your keyboard) and type cmd
and hit enter
. The command prompt will appear, it will display some text like to following below:
要访问命令提示符,请单击桌面工具栏上的Windows开始菜单(也可以按键盘上的Windows按钮),然后键入cmd
并按enter
。 将出现命令提示符,它将显示一些文本,如下所示:
C:\Users\YourUserName>
导航目录(在文件夹中移动) (Navigating Directories (Moving through folders))
C:\Users\YourUserName
is called your current working directory (directory is another way to say folder). It is like a street address that tells you where you are on your computer.
C:\Users\YourUserName
称为当前工作目录(目录是另一种表示文件夹的方式)。 就像街道地址一样,它告诉您您在计算机上的位置。
The current working directory can be a guide as you navigate through your computer. On the right of the >
we can type cd
, which stands for Change Directory, and the name of a directory that you want to navigate to. In this case we will type Documents
. Enter cd Documents
and your current working directory should look like the following:
当您浏览计算机时,当前工作目录可以作为指南。 在>
的右侧,我们可以键入cd
,它代表更改目录,以及您要导航到的目录的名称。 在这种情况下,我们将键入Documents
。 输入cd Documents
,您当前的工作目录应如下所示:
C:\Users\YourUserName\Documents>
To go back one directory type and enter cd..
. Your current working directory should return to this:
要返回一个目录,请输入cd..
。 您当前的工作目录应返回到以下位置:
C:\Users\YourUserName>
With the cd
and cd ..
commands you can move back and forth through directories. This might seem very basic at first but as you learn more commands the command prompt will become a very useful and efficient tool.
使用cd
和cd ..
命令,您可以在目录之间来回移动。 乍一看,这似乎很基础,但是随着您了解更多命令,命令提示符将成为非常有用和高效的工具。
以下是一些常用命令: (Here is a list of common commands:)
用法示例: (Usage Examples:)
制作目录 (Making a Directory)
mkdir name_of_the_directory_you_want_to_make
获取命令信息 (Getting Info on a Command)
your_command /?
删除文件和内容 (Deleting a File and Contents)
rm /s name_of_directory_you_want_to_delete
有用的提示: (Useful tips:)
The command
Ipconfig
shows your computer’s ip addressIpconfig
命令显示您计算机的IP地址If you type part of a directory’s name and hit the
tab
key the command prompt will autocomplete it and if you hit thetab
key repeatedly it will cycle through directories that start with the same letter如果键入目录名称的一部分并按
tab
键,命令提示符将自动完成该目录,如果反复按tab
键,它将循环浏览以相同字母开头的目录- You can use other shells or tools such as git bash or cmder to add more commands and functionality to your command prompt 您可以使用其他shell或工具(例如git bash或cmder)向命令提示符添加更多命令和功能。
Some tasks require you to run the command prompt as an administrator you clicking the windows button and typing
cmd admin
and hit theenter
key某些任务要求您以管理员身份运行命令提示符,方法是单击Windows按钮并键入
cmd admin
然后按enter
键If you know the path to a file or directory can type
cd PATH_TO_YOUR_DIRECTORY
instead of changing directories several times to get to a directory or file如果您知道文件或目录的路径,则可以键入
cd PATH_TO_YOUR_DIRECTORY
而不是多次更改目录以进入目录或文件- When you hit the up arrow key your previously entered command will appear and if you hit it repeatedly it will cycle through all of your previously entered commands 当您按下向上箭头键时,您先前输入的命令将会出现,如果您反复按下它,它将循环显示您先前输入的所有命令
翻译自: https://www.freecodecamp.org/news/how-to-use-the-command-prompt-in-windows/