下面是第一题的参考答案(请将echo 后的长空格换为tab): | @echo off&setlocal enabledelayedexpansion | | echo 姓名 工资 日期>a.xls | | for %%a in (甲 乙 丙 丁 戊 己 庚 辛 壬 癸) do ( | | for %%b in (1-31 2-28 3-31 4-30 5-31 6-30 7-31 8-31 9-30 10-31 11-30 12-31) do ( | | for /f "tokens=1,2 delims=-" %%c in ("%%b") do ( | | for /l %%e in (1,1,%%d) do set "_!random!!random!!random!=%%a-%%c-%%e" | | ) | | ) | | ) | | for /f "tokens=2,3,4 delims=-=" %%a in ('set _') do ( | | set "+=" | | set /a n+=1,a=!random!%%10,b=!random!%%101 | | if !a! equ 0 set "+=-" | | if !b! equ 0 set "+=" | | echo %%a !+!!b! 2009-%%b-%%c>>a.xls | | if !n! equ 1000 start a.xls&goto :eof | | ) COPY |
[ 本帖最后由 batman 于 2009-3-8 13:44 编辑 ] |