如何使用批处理脚本写入 .CSV 中的第二列?

How to write to the second column in .CSV using batch script?

我正在尝试从 .txt 文件中读取一列数字,并将它们放入 .csv 文件的第二列。

如何批量定义第二列?

for /f "tokens=1 delims= " %%i in (issn.txt) do (
 >>"anzahl.csv" echo %%i

这将创建文件 New-Anzahl.csv,当 issn.txt 中的条目数少于 anzahl.csv 计数时,该文件的 col2 为空。 issn.txt 悬垂被截断的其他方式。

@Echo Off & SetLocal EnableDelayedExpansion
Set "FileA=anzahl.csv"
Set "FileB=issn.txt"
<%FileB% (For /f "delims=" %%A in (%FileA%) Do (
    Set "B="&Set /P "B="
    Echo:%%A,!B!
)) >New-%FileA%