受batman代码启发 对于char.xls文件的生成 还是用个过度吧 效率上可提升点- @echo off&setlocal enabledelayedexpansion
- ::这里跳格键
- set "Tab= "
- set /p str=<char.txt>nul
- >char.xls echo !str!
- set "A区=候国强 毛远锋 易湛慧 李楠 池茜"
- set "B区=王冬 刘通 文娟娟 马宇芊"
- for %%i in (A区 B区) do for %%j in (!%%i!) do set %%j=%%i&>%%j.txt echo !str!
- for /f "skip=1 tokens=1-4" %%a in (char.txt) do (
- if /i "!%%d!" equ "%%a" (
- if !_%%d! lss 150 (
- set /a _%%d+=1
- >>%%d.txt echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- for /f "tokens=1,2 delims=." %%i in ("%%c") do (
- set d=%%j000
- set/a #%%d+=%%i!d:~,3!
- )
- ) else (
- 2>nul move "%%d.txt" "%%d_!#%%d:~,-3!.!#%%d:~-3!.xls"
- set %%d=&>>char.xls echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- )
- ) else >>char.xls echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- )
- for %%i in (A区 B区) do for %%j in (!%%i!) do if not defined %%j set %%i=!%%i:%%j=!
- for /f "tokens=1-4" %%a in (char.xls) do (
- for %%i in (!%%a!) do set name=%%~i
- for %%e in (!name!) do if !_%%e! lss 150 (
- set /a _%%e+=1
- >>%%e.txt echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- for /f "tokens=1,2 delims=." %%i in ("%%c") do (
- set d=%%j000
- set/a #%%e+=%%i!d:~,3!
- )
- ) else set %%a=!%%a:%%e=!&set name=&2>nul move "%%e.txt" "%%e_!#%%e:~,-3!.!#%%e:~-3!.xls"
- if not defined name >>char.x echo;%%a%Tab%%%b%Tab%%%c%Tab%%%d
- )
- move char.x char.xls
- pause
复制代码
|