How do I increment a DOS variable in a FOR /F loop?

后端 未结 5 1636
后悔当初
后悔当初 2020-12-13 00:02

I\'m trying to read text lines from a file, and increment a counter so I can eventually simulate an array in DOS.

I\'d like to be able to store the lines of text in

5条回答
  •  旧巷少年郎
    2020-12-13 00:19

    What about this simple code, works for me and on Windows 7

    set cntr=1
    :begin
    echo %cntr%
    set /a cntr=%cntr%+1
    if %cntr% EQU 1000 goto end
    goto begin
    
    :end
    

提交回复
热议问题