【问题标题】:Batch script copy x lines from a text file without trailing space批处理脚本从文本文件中复制 x 行,不带尾随空格
【发布时间】:2011-11-25 15:42:33
【问题描述】:

我正在尝试复制前 x 行
但是当我打开 list1 时,我会在每行之后看到空格
我希望每行后面都没有空格

for /F "eol=; tokens=1 delims=;" %%I in (text.txt) do (
    set /a count+=1
    if !count! leq 10 echo %%I>>list1
)

【问题讨论】:

    标签: batch-file copy lines spaces


    【解决方案1】:

    试试这个:

    for /F "eol=; tokens=1 delims=; " %%I in (text.txt) do (
      set /a count+=1
      if !count! leq 10 echo %%I>>list1
    )
    

    注意 'delims=; 中的空格'。

    【讨论】:

      猜你喜欢
      • 2022-06-15
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 2016-03-26
      • 1970-01-01
      • 2013-07-02
      • 2020-04-05
      • 2017-08-27
      相关资源
      最近更新 更多