Windows command prompt basics | Cyber Security Tutorial - Learn with VOKS
Back Next

Windows command prompt basics


What Is Command Prompt?

Command Prompt (often called cmd) is a text-based program in Windows that lets you control your computer by typing commands instead of clicking with a mouse.

Instead of:

  • Clicking folders
  • Using buttons
  • Navigating menus

You type instructions directly to the operating system.

It is also called a Command-Line Interface (CLI).

How to Open Command Prompt

Method 1:

  1. Press Windows key + R
  2. Type cmd
  3. Press Enter

Method 2:

  1. Click Start
  2. Type "Command Prompt"
  3. Click it

You’ll see something like:

C:\Users\YourName>

This is called the prompt. It shows your current location (directory).

Understanding Directories (Folders)

In Command Prompt:

  • Folders are called directories
  • Files are inside directories
  • Everything starts from a drive like C:\

Example path:

C:\Users\John\Documents>

This means:

  • You are in the Documents folder
  • Inside John’s user folder
  • On the C drive

Basic Navigation Commands

Show Files and Folders

dir

This lists everything in the current directory.

Change Directory

cd foldername

Example:

cd Documents

Go back one level:

cd ..

Go to root of drive:

cd \

Creating and Deleting Things

Create a Folder

mkdir MyFolder

or

md MyFolder

Delete a Folder

rmdir MyFolder

If the folder has files inside:

rmdir /s MyFolder

Create a File

type nul > file.txt

Delete a File

del file.txt

Viewing File Contents

type file.txt

This prints the file’s content to the screen.

Clearing the Screen

cls

This clears everything from the screen.

Running Programs

You can run programs by typing their name.

Example:

notepad

You can also run executable files:

program.exe

If the program is not in the current folder, you must give the full path:

"C:\Program Files\App\program.exe"

Getting Help

To see available commands:

help

To get help for a specific command:

help dir

Important Concepts

1. Case Sensitivity

Windows Command Prompt is NOT case-sensitive.

These are the same:

DIR
dir
Dir

2. Paths

There are two types of paths:

Absolute path:

C:\Users\John\Documents

Relative path:

Documents

Absolute starts from drive root.

Relative starts from current location.

3. Command Syntax Structure

Most commands follow this pattern:

command option target

Example:

rmdir /s MyFolder
  • command = rmdir
  • option = /s
  • target = MyFolder

Simple Practice Session

Example session:

dir
mkdir TestFolder
cd TestFolder
type nul > hello.txt
dir
type hello.txt
cd ..
rmdir /s TestFolder
cls

What this does:

  1. Lists files
  2. Creates folder
  3. Enters folder
  4. Creates file
  5. Lists contents
  6. Shows file content
  7. Goes back
  8. Deletes folder
  9. Clears screen


Example Code:
dir

cd foldername
cd ..
cd \

mkdir MyFolder
md MyFolder

rmdir MyFolder
rmdir /s MyFolder

type nul > file.txt
del file.txt

type file.txt

cls

notepad
program.exe
"C:\Program Files\App\program.exe"

help
help dir

dir
mkdir TestFolder
cd TestFolder
type nul > hello.txt
dir
type hello.txt
cd ..
rmdir /s TestFolder
cls
Cyber Security
Introduction Types of Cyber Threats Cyber Security Domains CIA Triad (Confidentiality Integrity Availability) Career paths in Cyber Security Certifications Ethics and Responsible Disclosure Laws and Regulation (e.g. GDPR, NDPR) What is an OS? Types: Window, Linus, macOS Command-line vs GUI OS Internals Overview (filesystems, processes, permissions) Windows command prompt basics Linux Bash Basics File System Navigation Basic Scripting IP Addressing DNS, DHCP Mac Address OSI VS TCP/IP Models Ports and Protocols (TCP, UDP) Common Protocols (HTTPS, FTP, SSH, etc.) Packet structure Firewalls, IDS/IPS, VPNs Common attacks: MITM, Sniffing Secure Network Practices How the Web works HTTP vs HTTPS URLs, Headers, Cookies Client-Server Architecture Introduction To Web Security OWASP Top 10 Overview Common Threats (XSS, SQLi, CSRF) Inpute validation and authentication flow Basic Exploitation demo (e.g. XSS) Burp Suite Introduction Using a Browser For Testing Password security MFA-Antivirus Cyber Hygeine Practice Intro To Tools: Nmap, Wireshark, Netstat
All Courses
Advance AI Bootstrap C C++ Computer Vision Content Writing CSS Cyber Security Data Analysis Deep Learning Email Marketing Excel Figma HTML Java Script Machine Learning MySQLi Node JS PHP Power Bi Python Python for AI Python for Analysis React React Native SEO SMM SQL