本帖最后由 batman 于 2011-5-28 02:56 编辑
随机很难:- @echo off&setlocal enabledelayedexpansion
- set "opath=这里改为你要复制的总目录名"
- set "npath=这里改为你要生成的总目录名"
- for /r "%opath%" %%a in (*.txt) do (
- if "!%%~pa!" equ "" (
- set /a n=0&set "%%~pa=a"
- set "str=%%~dpa"&set "str=!str:%opath%=%npath%!"
- if not exist "!str!" md "!str!"
- for /f %%b in ('dir "%%~dpa"^|findstr "个文件"') do set "num= "&set /a max=0&call :lp %%b
- for %%b in ("%%~dpa\*.txt") do (
- if !n! neq !max! (
- set /a n+=1
- for %%c in (!num!) do if %%c equ !n! move "%%b" "!str!"
- )
- )
- )
- )
- goto :eof
- :lp
- set /a a=!random!%%%1+1
- if "%max%" leq "%a%" set /a max=a
- if "!num: %a% =!" equ "!num!" set /a n+=1&set "num=!num! %a% "
- if "%n%" neq "20" goto lp
- set /a n=0
复制代码
|