Windows command line or MS-DOS prompt

MS-DOS is an operating system command line interface (non-graphical) of the Microsoft company. It is characterized by a prompt (eg "c: \> _") of white letters on a black background, where we can run text commands such as dir or cd.

Today, Windows has replaced the old system and maintains a command line interface called "cmd.exe". Also known as MS-DOS prompt.

This interface, is widely used by programmers, as it allows simple handling of many development tools of different technologies such as Android, Web servers and SQL, testing, installers...


How to start a MS-DOS prompt

The easiest way to start the console is to press the start button (Start) and when the menu opens, click on the search text box just above the start button. In this text box, type cmd and press the return key.


Current directory

When we open the console, the prompt indicates the current directory.

E.g: C: \ Users \ edup>, which means that we are on the C drive, in the edup directory, which is within the Users directory. Another way to know the current directory, is running the cd command without parameters.

The cd command also allows you to change the current directory:

E.g: "cd c: \" or "cd \" takes us to the root of the current drive.

To change the unit simply type the name of the unit, followed by a colon and return:

E.g: if I run d: in my case the prompt changes to D: \>

Execute programs

Programs are executable files, for example the ones which end with;:"exe" or "at".

To execute a program, just type the full file name including; drive, directory containing it and press the return key.

Eg: c:\windows\notepad.exe or c:\windows\notepad (extension is not necessary).

If my current position is the directory that contains the file to run, I can enter just the name:

Eg: c:\windows>notepad is enough

Environment variable PATH

There is a system variable called PATH, which keeps a list of directories, containing programs, separated by semicolons. If the file you want to run is located within one of these directories, you can execute it only with its name, regardless of our current location.

To view the contents of PATH, just run the command PATH:

E.G: PATH=C:\Program Files\Java\jdk1.7.0_45;C:\Windows;C:\Windows\System32; 

In this case we can run with notepad regardless of location.

To modify the value of this variable or another, see the tutorial environment variables in Windows and MS-DOS