可能会在for循环中使用(对于/ F%Skip%,对于/ F %% L,则是双精度,而对于/ F skipe = %% L,不使用变量)

问题描述 投票:0回答:1

如何在不使用skip=%%L设置变量的情况下在循环中使用双精度,而在for循环中不使用配置变量来设置?

此问题可能与此question相关,但它不符合我的需求。这不是帮助我的方法。我正在寻找的是一种在For / F循环内(内部)使用以下%%循环的方法,以便在循环内的skip=%%L巡回变量中使用,而对于< [skip=??_variable_??,仅skip=%%L

    有什么办法吗?
  • for /f %%L in ('call set /a "_some_count_varible_-=1"') do ( set "_for_loop_L=^tokens^=*^skip^=%%L^delims^=^ ^eol^=" && ( for /f %_for_loop_L% %%F in ('type file_mutiplelines.log') do ( echo=;%%~L;%%f;|findstr /lvie "specific_string" )))
    我需要像这样的代码进行工作:

    for /f %%L in ('call set /a "_some_count_varible_-=1"') do ( for /f ^tokens^=*^skip^=%%L^delims^=^ ^eol^= %%f in ('type file_muti_lines.log') do ( echo=;%%~L;%%f;|findstr /lvie "specific_string" ))

  • batch-file cmd
    1个回答
    0
    投票
    根据评论,我建议:

    set /a _some_count_variable_less_one_ = _some_count_variable_ - 1 for /f "tokens=* skip=%_some_count_variable_less_one_% delims= eol=" %%f in ('type file_mutiplelines.log') do ( echo=;%_some_count_variable_less_one_%;%%f;|findstr /lvie "specific_string;" )

    © www.soinside.com 2019 - 2024. All rights reserved.