Reading a text file line by line and storing it in an array using batch script

后端 未结 4 597
猫巷女王i
猫巷女王i 2021-01-05 14:57

I want to read a text file and store each line in an array. When I used the code below, \"echo %i%\" is printing 0 every time and only array[

4条回答
  •  自闭症患者
    2021-01-05 15:43

    @ECHO OFF
    SETLOCAL
    FOR /f "tokens=1*delims=:" %%i IN ('findstr /n /r "$" url.txt') DO SET max=%%i&SET array[%%i]=%%j
    FOR /l %%i IN (1,1,%max%) DO CALL ECHO(%%array[%%i]%%
    GOTO :EOF
    

    provided no line begins ":"

提交回复
热议问题