File rewriting: One line is greater than variable's max size. Workaround?

前端 未结 3 1052
北恋
北恋 2021-01-24 08:11

I need to replace a single line in a file. Generally, this code works fine:

(The actual specifics on what this block is doing is not necessary for this question).

<
3条回答
  •  佛祖请我去吃肉
    2021-01-24 08:41

    You could solve this with pure batch!

    :readLongLine
    < longline.tmp (
        for /L %%n in (1 1 20) do set /p part[%%n]=
    )
    

    After this your line is splitted into the variables part[1] .. part[20]

    Writing this to a new file you could use

    :writeLongLine
     longLine2.tmp
    

提交回复
热议问题