说明:set file=2.txt是设置你的原文件。set num=6是设置位数为6位。
@echo off
set file=2.txt
set num=6
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('type "%file%"') do (call :sub
echo !str:~,%num%! %%a>>temp)
del "%file%"&ren temp "%file%"'
exit
:sub
set str=%random%%random%%random%%random%
goto :eof
@echo off
setlocal ENABLEDELAYEDEXPANSION
set Num=100000
for /f "delims=" %%i in (1.txt) do (
echo !Num! %%i >>2.txt
set /a Num=!Num!+1
)
上面的代码1.txt是原文件,2.txt是编号的文件
100000是第一个学生编号
不用他那么麻烦