@echo off
set a=0
for /f %%a in (你要搜索的文件.txt) do set a=%%a
echo %a%
Does “set a=0” here have no effect at all? Can it be omitted?
Also:
@echo off & setlocal
set a=
for /f "delims=" %%a in (sample.txt) do set a=%%a
echo.%a%
It seems the effect is the same even if “ & setlocal” and “set a=” are removed?
set a=0
for /f %%a in (你要搜索的文件.txt) do set a=%%a
echo %a%
Does “set a=0” here have no effect at all? Can it be omitted?
Also:
@echo off & setlocal
set a=
for /f "delims=" %%a in (sample.txt) do set a=%%a
echo.%a%
It seems the effect is the same even if “ & setlocal” and “set a=” are removed?

