更新时间:2023-12-03 07:57:22
在Windows中,可以这样做:
In Windows, this will do it:
(for /f "delims=" %L in (oldfile.txt) do @echo predefined text %L)> newfile.txt
请注意,在批处理文件中,您需要使用双%
符号:
Note that in a batch file you'll need to use double %
signs:
(for /f "delims=" %%L in (oldfile.txt) do @echo predefined text %%L)> newfile.txt
还请注意,如果不将>"放在%L之后,则每行之后都会有一个空格.如果您使用">>"而不是>",则将继续添加到newfile.txt上,而不是每次运行时都创建一个新文件.
Note also that if you don't put the ">" right after the %L, you will get a space after every line. If you use ">>" instead of ">" you will keep adding on to newfile.txt instead of creating a new one each time you run it.