- @echo off
- :back
- setlocal enabledelayedexpansion
- set %random%=%random%
- set /a man=1
- set /a men=1
- set /a num1=0
- set /a num2=0
- for /F "delims=" %%n IN ('set') DO (
- if !man! EQU 1 (set flog=%%n)
- set man=!man!+1
- )
- for /f "delims== tokens=1,2" %%i in ("%flog%") do (
- set ax1=%%i
- set ax2=%%j
- )
- for /l %%a in (0 1 4) do (
- set /a num1=!num1!+!ax1:~%%a,1! 2>nul
- set /a num2=!num2!+!ax2:~%%a,1! 2>nul
- )
- if %num1% EQU %num2% goto end
- endlocal
- goto back
- :end
- echo %ax1% and %ax2% are all %num1%
- pause > nul
复制代码 研究时发现这个变量永远在set的第一行,因为set中的系统变量没有数字开头的,于是乎我偷懒了 |