The Computer Oracle

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

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC E Schuberts Piano Sonata D 784 in A

--

Chapters
00:00 Question
00:26 Accepted answer (Score 65)
00:49 Answer 2 (Score 116)
01:05 Answer 3 (Score 70)
01:42 Answer 4 (Score 49)
02:19 Thank you

--

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

Question links:
[vi]: http://en.wikipedia.org/wiki/Vi

--

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.