Bash/Shell

How to Use the Command Prompt in Windows

By ayed_amira , on 05/14/2020 , updated on 09/10/2020 - 3 minutes to read
command prompt in windows

How to Use the Command Prompt in Windows : In this part we will see how to use the command prompt on windows with some examples.

Overview

The first command prompt created by Microsoft was MS-DOS. MS-DOS is an operating system created in the 1980s. It was a widely used system in the 80’s to 90’s but was eventually gradually replaced by the advent of Windows and became a command prompt for Windows users. Windows makes this command prompt available in the different versions developed to date.

A command prompt, or command line, allows a user to ask their operating system to perform a task. For example:

  • List the files in a folder
  • Delete or Rename a file
  • Giving write permissions to a file to a user

There are a large number of commands available in this interface.

So we will see how to open and use this command prompt in windows.

MS-DOS Command Prompt

There are three ways to open the MS-DOS in Windows

First way : Search cmd in the windows search tool and open command prompt

command prompt windows search tool
First way example

Second way : Right-click the Start icon and select run.

command-prompt-start-button-windows
Second way example

Third way : Press the keyboard combination WinKey + R, then type cmd at the window that appears.

command-prompt-windows-and-r-keyboard-combinaison
Third way example

Common commands

With this command line,, we can execute many commands. Here are the main commands you can test :

Making a Directory

mkdir allows you to create a new directory

mkdir name_of_directory
 

Note : To get more information about the command, you can type mkdir /? this will list all the options of the command. It works for any command

mkdir windows

Display list of contents

the dir command allows you to list the files and folders in a directory.

dir name_of_directory
 

Change directory 

the cd command allows to change directory or display current directory path.

cd name_of_directory
 

You will find an exhaustive list via this link :

https://en.wikipedia.org/wiki/List_of_DOS_commands

PowerShell Command Prompt

Windows PowerShell is a command line shell and scripting language. Its Linux equivalent is called Bash Scripting. Built on the .NET Framework, Windows PowerShell automates the administration of the Windows operating system and applications running on the Windows Server environment.

there are two ways to open powershell.

First way : Right-click the Start icon and select Windows Powershell.

powershell windows
First way to open Powershell

Second way : : Press the keyboard combination WinKey + R, then type powershell at the window that appears.

Second Way to open Powershell

Windows Terminal

Microsoft has recently introduced a new interface for command prompts called Windows Terminal. It allows both MS-DOS and Powershel command lines to be combined under the same interface. It is getting closer and closer to the command prompts available in linux distributions.

It is not available directly under Windows 10, you have to go through the following address to download it :

https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab

Windows Terminal download

Conclusion

I hope you found this article interesting and helpful in the use of the windows command prompt. As you can see there are different ways to open a terminal under Windows.

Back to the Main Menu

ayed_amira

I'm a data scientist. Passionate about new technologies and programming I created this website mainly for people who want to learn more about data science and programming :)

Comments

Leave a comment

Your comment will be revised by the site if needed.