I have a problem with .bat
@echo off
set NAMEFILE=version
rem counting commas
set "f=%VERSION%"
set "vz=,"
set /a "z=0,n=0"
for /f "delims=" %%a in ('findstr /r /c:"\%vz%" "%f%"') do set "s=%%a"& call :#
<+ (for /f "tokens=1,2 delims==" %%b in ('more') do set /a "z+=%%b")& del+
set /a z =%z% + 1
rem cycle with problem
rem tokens=%%a* - part of the code that contains the problem
for /l %%a in (1,1,%z%) do for /f "tokens=%%a* delims=," %%i in (%NAMEFILE%) do @echo %%i>File_%%a.vers
:#
setlocal enabledelayedexpansion 2>nul
for %%a in ("!s:~%n%,1!") do (
if "%%~a"=="%vz%" set /a z+=1
if not "%%~a"=="" set /a n+=1& goto #
)
endlocal
exit /b
I don't know what to do with "tokens=%%a". It doesn't see variable %%a, maybe because of "%" symbols. I think it must be escaped or something like this. If u can help, please help.