
在 MS-DOS 中如何在檔案的每一行前面新增一個字串?
並且沒有第 3 方命令,因此沒有像 AWK 那樣的東西(我知道有些命令已經在 MSDOS 上運行)
我知道CMD(基於WinNT的作業系統中的cmd控制台,例如NT4以上的作業系統,例如XP或Win10),在for指令上有很多選項, https://www.robvanderwoude.com/ntfor.php 但 MS-DOS 沒有像 CMD 那樣的花俏的 FOR 指令
看https://web.archive.org/web/20100325172740/http://vfrazee.com/ms-dos/6.22/help/ 和 https://web.archive.org/web/20100521101405/http://www.vfrazee.com/ms-dos/6.22/help/for.htm
那麼在 MS-DOS 中你會怎麼做呢?
且沒有 QBASIC
答案1
一種稱為「彈出命令提示字元」的方法。
這是 MS-DOS 的作者無法想像的創新方法。
在CMD中也可以使用
在新聞群組和新聞組時代就曾提到這一點。
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>