NOTE: If you already know the fundamentals of Command Prompt, you can skip this section and proceed to the next one.
Command Prompt is a text-based interface environment (or command shell) used to execute various commands. It offers the robust approach to interact with the operating system, which also provides more advanced features to perform advanced operations.
To start the Command Prompt, there are ways to do it:
From the Windows menu
1. Click the Windows icon or press the Windows key in the keyboard.
2. Search for "cmd"
3. Press Enter or click "cmd"
From the Run dialog
1. Press both Windows key and R simultaneously (or search it in the Windows menu).
2. Type "cmd" and press Enter (or clicking OK).
Once started, it should look like the screenshot shown at the left. It is simply a window that has black background and white text; moreover, it depends on the default configuration set.
The foreground and background colors of Command Prompt can be customized using the context menu behind the application icon.
Parts of a Command Prompt window:
1. Application icon - When clicked, it shows the context menu containing a bunch of actions, such as modifying the configuration, pasting text, etc.
2. Title bar - Shows the current title, which defaults to the full path of Command Prompt.
3. Current working directory - It is the directory within a file system where the user is currently located and where commands and operations are executed (acc. to Science Direct).
4. Prompt - It is the area where commands are typed and executed.
We execute commands to accomplish operational tasks. A command usually comprises the name of the program or executable and a set of arguments and/or options.
Let's run a command that displays text on the output area. Type the following in the Command Prompt:
Press Enter to execute the command, and once executed, you should see the output after the line where the command is typed.
Notice the prompt reappears after running a command. Command Prompt is doing this to let the user type another command if needed. This kind of environment is called Read-Eval-Print-Loop (REPL). REPL offers an environment that allows interaction with another digital entity, such as an operating system or runtime of any high-level programming language. REPL reads the user input, then it evaluates the input, prints the result, and repeat until the user types the command or function to signal termination (or to exit).
This line "echo Hello world" comprises the command "echo" which is used to display text on the output area, and it takes an argument "Hello world" which is used to provide information for the command to process.
The table at the left are the list of other basic commands that you can play with inside Command Prompt.
The pair of characters (or sometimes more than a pair) starting with a forward slash you see in some commands are called switches.
Switches are basically modifiers that alters the function of a command. For example, the /s switch in rd indicates the command to delete the files and subdirectories of the specified directory.