logoalt Hacker News

TeMPOraLtoday at 10:31 AM1 replyview on HN

Well, there was a workaround (that I only learned today) for creating new files:

    copy con file_to_edit.txt
Type text, end with CTRL+Z. Don't make any typos.

That's what web search told me, but then looking at the remarks in docs for `copy`[0], I have to wonder if this works now, and if it would've worked back then:

    copy prefix.txt+con+suffix.txt output.txt
If it does, then combined with some clever use of `find`, `findstr` or `for` (whichever was available back then), you could probably get something that's half-way between EDIT.COM and a line editor.

(`more` would come in handy here, but AIUI, there's no way to run it non-interactively in cmd.exe? Don't have a Windows machine handy to check it right now.)

--

[0] - https://learn.microsoft.com/en-us/windows-server/administrat...


Replies

einrtoday at 10:46 AM

copy prefix.txt+con+suffix.txt output.txt

This does indeed work in proper MS-DOS. Congratulations for figuring out probably the single most masochistic way of accomplishing text editing ;)