Why variables are not set

前端 未结 2 1347
野的像风
野的像风 2020-12-22 10:00

I have a file report.txt having comma separated values like (1,2,3,4). I am checking if the file is not blank then assign the 4 variables with values in the file. But the va

2条回答
  •  借酒劲吻你
    2020-12-22 10:21

    setlocal enabledelayedexpansion
    
    for /f %%i in ("Report.txt") do set size=%%~zi 
    if %size% gtr 0 (
    

    I changed the code as below and it started working. Thank you guys for your time. Appeciate it.

    for /F "tokens=1-4 delims=," %%A in (%cd%\Report.txt) do (
        set "var1=%%A"
        set "var2=%%B"
        set "var3=%%C"
        set "var4=%%D"    
    
    )
    set var
    )
    echo !var1!
    

提交回复
热议问题