The Computer Oracle

How do I edit text files in the Windows command prompt?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over

--

Chapters
00:00 How Do I Edit Text Files In The Windows Command Prompt?
00:18 Accepted Answer Score 66
00:34 Answer 2 Score 31
00:50 Answer 3 Score 120
01:01 Answer 4 Score 76
01:29 Thank you

--

Full question
https://superuser.com/questions/186857/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #commandline #ssh #texteditors

#avk47



ANSWER 1

Score 120


The simplest solution on all versions of Windows is:

C:\> notepad somefile.txt

And, no extra software required.




ANSWER 2

Score 76


From a Windows command prompt enter copy con followed by the target file name. (copy con c:\file.txt).

Then enter the text you want to put in the file.

End and save the file by pressing CTRL-Z then Enter or F6 then Enter.

If you want to change text in an existing file simply display the text by using the command type followed by the file name and then just copy and paste the text in to the copy con command.




ACCEPTED ANSWER

Score 66


edit filename

I won't vouch for its functionality and outdated GUI but it is installed by default, even on Windows 7.

Edit: Except 64 bit versions of Windows.




ANSWER 4

Score 31


If you're used to vi and don't want to settle for the built-in editor you can get Vim for Windows. It'll run from a command shell. Or try WinVi.