Visit Website

How to Create, Edit & Delete Files Using CMD | Essential Commands for Beginners

Learn how to create, edit, view, rename, move, and delete files using CMD in Windows. Essential Command Prompt file commands for beginners.

Command Prompt (CMD) is a powerful built-in tool in Windows that allows you to manage files and folders without using File Explorer.

By learning a few basic commands, you can create, edit, view, rename, and delete files directly from CMD.

This beginner-friendly guide explains the most useful file management commands step-by-step.


📌 Why Use CMD for File Management?

Using CMD can help you:

  • Work faster

  • Automate tasks

  • Manage files efficiently

  • Learn basic computer administration

  • Understand Windows commands better


💻 Step 1: Open Command Prompt

Method 1

  1. Press:

Windows + R
  1. Type:

cmd
  1. Press Enter

CMD will open.


📄 Create a New Text File

Method 1: Using ECHO Command

Create a text file with content:

echo Hello World > myfile.txt

This creates:

myfile.txt

with the text "Hello World".


Method 2: Create Empty File

type nul > myfile.txt

This creates an empty file.


📂 View Files in Current Folder

Use:

dir

This displays all files and folders in the current directory.


📝 View File Contents

Use:

type myfile.txt

CMD will display the contents of the file.


✏️ Edit a Text File

Add more text:

echo Welcome to CodeSardar >> myfile.txt

The >> symbol adds text without removing existing content.


📖 Open a File in Notepad

Use:

notepad myfile.txt

The file will open in Notepad where you can edit it normally.


📋 Copy a File

Example:

copy myfile.txt backup.txt

This creates a copy named:

backup.txt

✂️ Rename a File

Use:

ren myfile.txt notes.txt

The file name changes to:

notes.txt

🚚 Move a File

Example:

move notes.txt Documents

This moves the file to the Documents folder.


❌ Delete a File

Delete a file using:

del notes.txt

The file will be permanently removed.


🗑️ Delete Multiple Files

Delete all text files:

del *.txt

⚠️ Be careful when using wildcard commands.


📊 Useful File Commands Summary

CommandFunction
echo Text > file.txtCreate file with content
type nul > file.txtCreate empty file
dirView files
type file.txtView file content
echo Text >> file.txtAdd text
notepad file.txtOpen file
copy file1 file2Copy file
ren old newRename file
move file folderMove file
del file.txtDelete file

🚀 Practice Example

Create a file:

echo Learning CMD > practice.txt

View file:

type practice.txt

Rename file:

ren practice.txt mynotes.txt

Delete file:

del mynotes.txt

⚠️ Important Tips

  • Double-check file names before deleting

  • Use dir frequently to verify files

  • Avoid deleting important system files

  • Practice inside a test folder first


📝 Final Words

Learning how to create, edit, and delete files using CMD is one of the most important beginner skills in Windows. These commands are simple, useful, and often used in scripting, automation, and troubleshooting.

Once you master these basics, you'll be ready for more advanced CMD operations.

For more Windows CMD tutorials and tricks, visit CodeSardar.


❓ Frequently Asked Questions 

Q1. Can CMD create files without Notepad?
Yes, using commands like echo and type nul.

Q2. How do I view file contents in CMD?
Use the type command.

Q3. Is del command permanent?
Yes, deleted files usually do not go to the Recycle Bin.


Complete Video Guide/Tutorial


Post a Comment

Have a question or feedback? Share it below! Please avoid spam and stay respectful.
Visit Website
Visit Website