=。=- @echo off
- setlocal enabledelayedexpansion
-
- set /a strn=0
- set item_a=搜狐网
- set item_b=新浪网
- set item_c=腾讯网
- set item_d=中华网
-
- ::现在调用函数,组合abcd字符,一个字母的掠过
- call :func "abcd" ""
- echo 筛选出的组合个数%strn%
-
- ::开始文件操作
- cd /d "C:\Documents and Settings\Administrator\桌面\新建文件夹"
- for /f "delims=" %%a in ('dir /a-d/b *.html') do (
- set file=%%a
- setlocal enabledelayedexpansion
- set /a n=!random!%%strn+1
- for %%x in (!n!) do (echo; !str_%%x! - %%a)
- (
- for %%y in (!n!) do echo;!str_%%y!
- type "!file!"
- )> "%temp%\~tmp"
- move "%temp%\~tmp" "!file!"
- endlocal
- )
- pause &exit
-
- :func
- set tmpstr=%~2
- if %1=="" (
- if not %2=="" (
- if not "!tmpstr:~2!"=="" (
- set /a strn+=1
- set "tmpstr2="
- for %%i in (!tmpstr!) do (set tmpstr2=!tmpstr2!!item_%%i!)
- echo 筛选的组合 !tmpstr2!
- set "str_!strn!=^<title^>!tmpstr2!^</title^>"
- )
- )
- goto :eof
- )
- set strnow=%~1
- call :func "%strnow:~1%" "%~2 %strnow:~0,1%"
- set strnow=%~1
- call :func "%strnow:~1%" "%~2"
- goto :eof
复制代码
[ 本帖最后由 523066680 于 2010-7-16 09:45 编辑 ] |