CMD Master
Back to Blog
Arnošt Havelka

Opening Files in a Text Editor

Learn to open and edit files with Notepad directly from the command line.

Start Interactive Lesson
Opening Files in a Text Editor

Opening Files in a Text Editor

Before you can write or modify a batch script, you need to know how to open a file in a text editor from the command line. On Windows, the built-in editor is Notepad — and you can launch it for any file directly from CMD.

Usage:notepad
[filename]
notepad
Opens Windows Notepad. If the file doesn't exist, Notepad offers to create it.
notepad script.bat
Opens a batch file in Notepad for editing.
start .
Opens the current folder in Explorer — handy for double-click editing.

Step 1: Open a Text File

Type notepad readme.txt in the terminal. Notepad opens the file so you can read and edit it.

Command Prompt
C:\Users\User>notepad readme.txt

Tip: If the file does not exist yet, Notepad will ask if you want to create it. Click Yes and start typing!

Step 2: Open a Batch File for Editing

The real power comes when you open .bat files to write commands:

Command Prompt
C:\Users\User>notepad script.bat

Why Notepad? Notepad saves files as plain text — exactly the format CMD needs to execute .bat scripts. Never use Word or rich-text editors for batch files.

Step 3: Save and Close

Once you finish editing in Notepad:

REM After saving your edits, run the file:
script.bat

Knowledge Check

1 / 3

Which command opens a file in Notepad from CMD?

Up Next

Create Your First Commented Batch File

Write a real .bat script with REM comments using the built-in code editor.