Basic windows commands
These are basic windows functionality and commands you need to know.
Windows command prompt
The Windows Command Prompt, also known as cmd or cmd.exe, is a command-line interpreter application available in most Windows operating systems. It provides a text-based interface through which users can interact with the operating system by typing commands.
You can type "cmd" or "command" into the search bar next to the Windows start button as shown in the image below. Press Enter or click on the "Command Prompt" app that appears in the search results.
The command prompt window looks similar to the image below. You can type commands into this window.
Basic commands
Note: Windows folder and directory mean the same.
Command | Purpose |
---|---|
cd | To print path to current folder. |
cd .. | To change to the parent folder. |
md | To make a new folder. |
cd "*folder path*" | Change to a different folder. |
explorer.exe . | To open current folder in windows explorer. |
explorer.exe .. | To open parent folder in windows explorer. |
explorer.exe "*folder path*" | To open a folder in windows explorer. |
cls | To clear the screen. |
path | To print value of the PATH variable. |
exit | To close the command prompt window. |
rd /s /q "*folder path*" | To delete a non-empty directory or folder. This is the equivalent of rm -rf in linux. |
Examples
cd
md "c:\coursework"
cd "c:\coursework"
explorer .
path
cls
exit
A note about PATH
Note: PATH variable is different from "path" to a folder on windows.
In Windows, the PATH variable stores the list of directories to search to find the commands(or executable) you type at command prompt. When you run a command in the Command Prompt, Windows looks for the corresponding executable file in these directories. If an executable file is not in one of the directories listed in the PATH variable, you can only execute the command by specifying the full path to the executable file each time.
Fo example, when you install Python, you may want to add the folder where Python is located to the path variable. The python installer provides an option to automatically add the python installation folder to this path variable as part of the installation process. If you did not select this option, you have to manually add the python folder path to the environment variable one time.