Windows & DOS
Prompt Commands
Unit 1: Computers & Cyber Security
Abhishek Sonker
What is Windows Command Prompt (DOS
Prompt)?
The Command Prompt (cmd.exe) is a text-based interface used in
Windows to run commands for:
● File & folder management
● System administration
● Network diagnostics
● Cybersecurity investigations
● Troubleshooting
Why are Dos Commands used?
● File Management: Users to navigate through directories and
create, delete, or copy files, enabling efficient file management.
● System Configuration: Users can configure system settings,
manage drives, and analyze hardware issues using Dos
commands, providing a robust toolkit for system customization.
● Program Execution: Facilitate the execution of programs and
scripts, offering a streamlined approach to launching applications
without the need for graphical interfaces.
● dir for listing files,
● cd for changing directories,
● md or mkdir for creating
directories,
● del for deleting files,
● copy for copying files.
● ipconfig for network
information,
● ping for testing connectivity,
● tasklist to see running
programs,
● shutdown to turn off the
computer.
Common DOS prompt (Command Prompt in modern Windows)
commands include:
BASIC DOS COMMANDS
dir – List Files and Folders
Shows everything in the current
directory.
Output Shows:
● Files
● Folders
● Sizes
● Dates
Example:
C:Users> dir
cd – Change Directory
Used to move between folders.
Example:
To go back:
To go to root:
C:> cd WindowsSystem32
cd ..
cd
mkdir – Create Folder
Creates a new folder.
Example: C:> mkdir cyberlab
rmdir – Remove Folder
Deletes an empty directory.
Example: C:> rmdir emptyfolder
To delete entire folder with files: rmdir /s /q cyberlab
copy – Copy Files
Copies a file from source to destination.
Example: C:> copy report.txt backupreport.txt
move – Move or Rename File
Move or rename the file name.
Example: C:> move a.txt documentsa-old.txt
del – Delete a File
Delete the file from the folder or the source destination
Example: C:> del secret.txt
type – Display Contents of a File
Display Contents of a File
Example: C:> type notes.txt
SEARCHING & FILTERING
COMMANDS
findstr – Search Text in Files
Useful for log analysis.
Example: C:> findstr /i "error" server.log
Searches for the word error (case-insensitive) inside server.log.
Pipes (|) – Connect Commands
Example: C:> ipconfig | findstr IPv4
Output is filtered to only show IPv4 addresses.
Redirection (>, >>)
Save output to file.
Example: C:> dir > filelist.txt
Searches for the word error (case-insensitive) inside server.log.
Append instead of overwrite: >> filename
SYSTEM & NETWORK
COMMANDS
(Cyber Security Essentials)
ipconfig – Network Configuration
Displays IP address, gateway, DNS, MAC address.
Example: C:> ipconfig /all
netstat – Active Connections & Ports
Shows open ports and connections.
Example: C:> netstat -ano
Useful to detect malware opening unknown ports.
ping – Test Connectivity
Network utility that checks connectivity between two devices by
sending a packet and measuring the round-trip time for a response, also
known as latency
Example: C:> ping google.com
tracert – Trace Network Route
Traces the path of data packets across a network to a destination,
showing each "hop" (router) along the way and the time it takes to reach
each one.
Example: C:> tracert google.com
nslookup – DNS Lookup
(Name Server Lookup) command-line tool is used to query the Domain
Name System (DNS) to retrieve domain names, IP addresses, and other
DNS records for troubleshooting or network administration purposes.
Example: C:> nslookup example.com
tasklist – List Running Programs
Used to display a list of all currently running processes on your
computer.
Example: C:> tasklist
taskkill – Terminate Program
Used to terminate running processes from the command line. This is
particularly useful when a program becomes unresponsive and cannot
be closed through the graphical user interface.
Example: C:> taskkill /PID 1234 /F
Program can be be terminate by:
● Process ID (/PID)
● ImageName (/IM)
● Force Termination (/F)
ADVANCED/ADMIN COMMANDS
(Used in Cyber Investigations)
systeminfo – System Details
Shows OS type, version, hotfixes, BIOS, etc.
Example: C:> systeminfo
net user – User Accounts
You can view a list of all user accounts and used to create, delete, and
modify local user accounts
Example: C:> net user
Check account details: C:> net user Administrator
View details for a specific user:
Disable a user:
Enable a user:
net user <username>
net user <username> /active:no
net user <username> /active:yes
View all user accounts:
Create a new user:
Delete a user:
net user
net user <username> <password> /add
net user <username> /delete
net share – Shared Folders
To manage shared folders, allowing you to create, view, and delete
network shares from the command line.
Example: C:> net share
ipconfig /displaydns – DNS Cache
Shows the contents of the local DNS cache, which is a temporary
storage of domain names and their corresponding IP addresses.
Example: C:> ipconfig
SIMPLE PRACTICAL LAB
(STEP-BY-STEP)
Lab: Create, Copy, View, Search Files
1. mkdir lab
2. cd lab
3. echo Hello Cyber Security > note.txt
4. type note.txt
5. copy note.txt backup.txt
6. dir
7. findstr /i "cyber" note.txt
Expected outcomes:
● Creates folder
● Creates text file
● Displays contents
● Copies the file
● Searches content
Windows Command
Workflow
Command Prompt
Output
User enters command
Windows interprets it
SUMMARY
● Windows DOS prompt allows direct interaction with the system.
● Commands like dir, cd, copy, del handle file tasks.
● Commands like ipconfig, netstat, tracert, nslookup are used in
cybersecurity.
● Filtering tools (findstr, pipes) help in log and network analysis.
● CMD is essential for digital forensics, troubleshooting, and
penetration testing.

Windows Command Prompt and DOS Prompt Commands

  • 1.
    Windows & DOS PromptCommands Unit 1: Computers & Cyber Security Abhishek Sonker
  • 2.
    What is WindowsCommand Prompt (DOS Prompt)? The Command Prompt (cmd.exe) is a text-based interface used in Windows to run commands for: ● File & folder management ● System administration ● Network diagnostics ● Cybersecurity investigations ● Troubleshooting
  • 3.
    Why are DosCommands used? ● File Management: Users to navigate through directories and create, delete, or copy files, enabling efficient file management. ● System Configuration: Users can configure system settings, manage drives, and analyze hardware issues using Dos commands, providing a robust toolkit for system customization. ● Program Execution: Facilitate the execution of programs and scripts, offering a streamlined approach to launching applications without the need for graphical interfaces.
  • 4.
    ● dir forlisting files, ● cd for changing directories, ● md or mkdir for creating directories, ● del for deleting files, ● copy for copying files. ● ipconfig for network information, ● ping for testing connectivity, ● tasklist to see running programs, ● shutdown to turn off the computer. Common DOS prompt (Command Prompt in modern Windows) commands include:
  • 5.
  • 6.
    dir – ListFiles and Folders Shows everything in the current directory. Output Shows: ● Files ● Folders ● Sizes ● Dates Example: C:Users> dir
  • 7.
    cd – ChangeDirectory Used to move between folders. Example: To go back: To go to root: C:> cd WindowsSystem32 cd .. cd
  • 8.
    mkdir – CreateFolder Creates a new folder. Example: C:> mkdir cyberlab
  • 9.
    rmdir – RemoveFolder Deletes an empty directory. Example: C:> rmdir emptyfolder To delete entire folder with files: rmdir /s /q cyberlab
  • 10.
    copy – CopyFiles Copies a file from source to destination. Example: C:> copy report.txt backupreport.txt
  • 11.
    move – Moveor Rename File Move or rename the file name. Example: C:> move a.txt documentsa-old.txt
  • 12.
    del – Deletea File Delete the file from the folder or the source destination Example: C:> del secret.txt
  • 13.
    type – DisplayContents of a File Display Contents of a File Example: C:> type notes.txt
  • 14.
  • 15.
    findstr – SearchText in Files Useful for log analysis. Example: C:> findstr /i "error" server.log Searches for the word error (case-insensitive) inside server.log.
  • 16.
    Pipes (|) –Connect Commands Example: C:> ipconfig | findstr IPv4 Output is filtered to only show IPv4 addresses.
  • 17.
    Redirection (>, >>) Saveoutput to file. Example: C:> dir > filelist.txt Searches for the word error (case-insensitive) inside server.log. Append instead of overwrite: >> filename
  • 18.
  • 19.
    ipconfig – NetworkConfiguration Displays IP address, gateway, DNS, MAC address. Example: C:> ipconfig /all
  • 20.
    netstat – ActiveConnections & Ports Shows open ports and connections. Example: C:> netstat -ano Useful to detect malware opening unknown ports.
  • 21.
    ping – TestConnectivity Network utility that checks connectivity between two devices by sending a packet and measuring the round-trip time for a response, also known as latency Example: C:> ping google.com
  • 22.
    tracert – TraceNetwork Route Traces the path of data packets across a network to a destination, showing each "hop" (router) along the way and the time it takes to reach each one. Example: C:> tracert google.com
  • 23.
    nslookup – DNSLookup (Name Server Lookup) command-line tool is used to query the Domain Name System (DNS) to retrieve domain names, IP addresses, and other DNS records for troubleshooting or network administration purposes. Example: C:> nslookup example.com
  • 24.
    tasklist – ListRunning Programs Used to display a list of all currently running processes on your computer. Example: C:> tasklist
  • 25.
    taskkill – TerminateProgram Used to terminate running processes from the command line. This is particularly useful when a program becomes unresponsive and cannot be closed through the graphical user interface. Example: C:> taskkill /PID 1234 /F Program can be be terminate by: ● Process ID (/PID) ● ImageName (/IM) ● Force Termination (/F)
  • 26.
    ADVANCED/ADMIN COMMANDS (Used inCyber Investigations)
  • 27.
    systeminfo – SystemDetails Shows OS type, version, hotfixes, BIOS, etc. Example: C:> systeminfo
  • 28.
    net user –User Accounts You can view a list of all user accounts and used to create, delete, and modify local user accounts Example: C:> net user Check account details: C:> net user Administrator
  • 29.
    View details fora specific user: Disable a user: Enable a user: net user <username> net user <username> /active:no net user <username> /active:yes View all user accounts: Create a new user: Delete a user: net user net user <username> <password> /add net user <username> /delete
  • 30.
    net share –Shared Folders To manage shared folders, allowing you to create, view, and delete network shares from the command line. Example: C:> net share
  • 31.
    ipconfig /displaydns –DNS Cache Shows the contents of the local DNS cache, which is a temporary storage of domain names and their corresponding IP addresses. Example: C:> ipconfig
  • 32.
  • 33.
    Lab: Create, Copy,View, Search Files 1. mkdir lab 2. cd lab 3. echo Hello Cyber Security > note.txt 4. type note.txt 5. copy note.txt backup.txt 6. dir 7. findstr /i "cyber" note.txt
  • 34.
    Expected outcomes: ● Createsfolder ● Creates text file ● Displays contents ● Copies the file ● Searches content
  • 35.
  • 36.
    Command Prompt Output User enterscommand Windows interprets it
  • 37.
  • 38.
    ● Windows DOSprompt allows direct interaction with the system. ● Commands like dir, cd, copy, del handle file tasks. ● Commands like ipconfig, netstat, tracert, nslookup are used in cybersecurity. ● Filtering tools (findstr, pipes) help in log and network analysis. ● CMD is essential for digital forensics, troubleshooting, and penetration testing.