和楼上的基本相似,理了理思路,这样代码更易懂:- @echo off
- (for /l %%i in (1,1,500) do (
- setlocal enabledelayedexpansion
- for /l %%j in (0,1,99) do (
- set /a n+=1
- if %%j lss 10 (
- set _!random!-!n!=0%%j
- ) else (
- set _!random!-!n!=%%j
- )
- )
- for /f "tokens=2 delims==" %%k in ('set _') do (
- set /a m+=1
- if !m! leq 50 (
- set str1=!str1! %%k
- ) else (
- set str2=!str2! %%k
- )
- )
- echo,!str1!
- echo,!str2!
- endlocal
- ))>1.txt
- pause
复制代码
|