入門 (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/