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.
Navigate to the files directory
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
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:
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.

