0

How do you prepend a string to each line of a file in MS-DOS?

And with no 3rd party commands so nothing like AWK (which I understand some have got running on MSDOS)

I know CMD(The cmd console in WinNT based OSs like NT4 onwards eg XP or Win10), has many options on the for command, https://www.robvanderwoude.com/ntfor.php but MS-DOS doesnt have the fancey FOR command that CMD does

see https://web.archive.org/web/20100325172740/http://vfrazee.com/ms-dos/6.22/help/ and https://web.archive.org/web/20100521101405/http://www.vfrazee.com/ms-dos/6.22/help/for.htm

So how would you do it in MS-DOS?

And without QBASIC

3

1 Answer 1

3

A method called "Bouncing off the command prompt".

An innovative method that the authors of MS-DOS would not have imagined.

It works in CMD too

It was mentioned in the days of usenet and newsgroups.

C:\rara>dir /b
file.txt

C:\rara>type file.txt
house
fish
dog

C:\rara>ren file.txt file.bat

C:\rara>prompt the

thefile >file2
'house' is not recognized as an internal or external command,
operable program or batch file.
'fish' is not recognized as an internal or external command,
operable program or batch file.
'dog' is not recognized as an internal or external command,
operable program or batch file.

theprompt $p$g

C:\rara>type file2

thehouse

thefish

thedog

C:\rara>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .