:: bbs.bathome.net 2010-09-10 21:16
- 未考虑文件名及文件内容含半角 ! 的情况
- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in (随机.txt) do (
- set /a n+=1
- set ".!n!=%%a"
- )
- md temp
- for %%i in (*.txt) do (
- if not "%%~nxi"=="随机.txt" (
- set /a m=0,h=0
- for /f "usebackq" %%a in ("%%i") do set /a m+=1
- set "htm=temp\%%~ni.html"
- echo %%~ni^<br^>>"!htm!"
- set /a w=!random!%%n+1,w2=!random!%%m+1
- for /f "usebackq delims=" %%j in ("%%i") do (
- set /a h+=1
- if !h! equ !w2! (
- for %%b in (!w!) do echo !.%%b!^<br^>>>"!htm!"
- )
- echo %%j^<br^>>>"!htm!"
- )
- )
- )
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%a in (123.txt) do (
set /a n+=1
set ".!n!=%%a"
)
md temp
for %%i in (*.txt) do (
if not "%%~nxi"=="123.txt" (
set /a m=0,h=0
for /f "usebackq" %%a in ("%%i") do set /a m+=1
set "htm=temp\%%~ni.html"
echo %%~ni^
>"!htm!"
set /a w=!random!%%n+1,w2=!random!%%m+1
for /f "usebackq delims=" %%j in ("%%i") do (
set /a h+=1
if !h! equ !w2! (
for %%b in (!w!) do echo !.%%b!^
>>"!htm!"
)
echo %%j^
>>"!htm!"
)
)
)
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |