How to Edit Text Files in the Windows Command Prompt

Learn how you can quickly edit text files using the windows command prompt with some easy commands.

Edit Text Files in the Windows Command Prompt
Edit Text Files in the Windows Command Prompt

Do you need to edit a text file, but don't want to open up a bloated word processing program? Maybe you're on a computer without that software installed, or you just don't feel like dealing with the extra steps. In either case, Windows has you covered. You can easily edit text files in the command prompt. Learn how to do exactly that in this article.

Let's get started.

Open the Command Prompt

The first step is to open the command prompt. You can do this by opening the Start menu and typing cmd into the search bar. Alternatively, you can press Windows + R to open the Run dialog box, then type cmd and press Enter.

Once you have the command prompt open, use the cd command to move to the directory that contains the file you want to edit.

For example:

If the file is in your Desktop folder, type in the following command:

cd desktop
Subscribe to be notified when a full tutorial on how to do simple file management using the command prompt is available.

Editing your file.

Now that you're in the right directory, you can start editing your text file. To do this, type:

notepad filename.txt

where filename.txt is the name of your file. This will open the file in Notepad so that you can make changes.

When you're done making changes, save the file and close Notepad.

Bonus

You can also view the contents of the file from the cmd with the following command:

type filename.txt

Example:

type geekbits.txt

Returns:

file-edit-with-cmd

Using Vim to edit text files with command prompt

Another option is to use Vim, one of the best text editors for programmers and developers. This article gives an in-depth tutorial for using Vim on the windows command prompt.

Edit Text files with Vim in the windows command prompt/

And that's all there is to it! Now you know how to edit text files in the Windows command prompt. Give it a try next time you need to make a quick change to a text file without opening up a full-fledged word processor.

Ending ...

These commands are some of the many useful commands that help in managing files in windows. Full tutorial coming up so stay tuned for that.

If you enjoy our content, please consider buying us a coffee to support our work:

How to install Vim Editor on Windows
Vim is a versatile editor that is highly customizable. For this reason, it has won the hearts of those who prefer high levels of customization and control in their text editors. With Vim, you can use key mappings to execute sophisticated commands. Vim also offers a Recording feature that makes
How to Use the cd Command in Linux
In this article, you will learn the in and outs of the cd command. This will enable you to use your Linux terminal to navigate through your filesystem with ease.
Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.