本帖最后由 ArdentMan 于 2011-7-8 09:09 编辑
- @Echo Off&SetLocal EnableDelayedExpansion
- For /R %%a In (*.mp4 *.rmvb) Do (
- Set "Str=%%~nxa"&Set "Flag="
- For /F "Delims=" %%b In ('Dir /ad /b /s F:\视频') Do (
- If Not Defined Flag (
- Set "Var=%%~nb"
- For %%c In ("!Var!") Do If "!Str:%%~c=!" NEQ "!Str!" Set "Flag=a"
- For %%c In ("!Str!") Do If "!Var:%%~c=!" NEQ "!Var!" Set "Flag=a"
- If Defined Flag Move "%%a" "%%b\"
- )
- )
- If Not Defined Flag (
- SetLocal&Cls
- For /f "Delims=" %%b In ('Dir /ad /b F:\视频') Do (
- Set /A Num+=1,Number+=1&Set ".!Num!=F:\视频\%%b"
- Set "Str=000!Num!"&Set "Var=%%b "
- Set /P=[!Str:~-3!]!Var:~,20!<nul
- If "!Number!" EQU "2" Echo,&Set /A Number=0
- )
- Echo,&Set "Str="&Set /P Str=请选择文件夹:
- EndLocal&For %%b In ("!Str!") Do Set "Str=!.%%~b!"
- Echo,&Set "Var="&Set /P Var=请输入模式(A或者D):
- If /i "!Var!" EQU "D" (
- SetLocal&Cls
- For /F "Delims=" %%b In ('Dir /s /ad /b "!Str!"') Do (
- Set /A Num+=1,Number+=1&Set ".!Num!=%%b"
- Set "Str1=000!Num!"&Set "Var=%%b "
- Set /P=[!Str1:~-3!]!Var:~,20!<nul
- If "!Number!" EQU "2" Echo,&Set /A Number=0
- )
- Echo,&Set "Str="&Set /P Str=请选择文件夹:
- EndLocal&For %%b In ("!Str!") Do Set "Str=!.%%~b!"
- )
- Cls&Set /P Name=所选文件夹是!Str!,请输入新文件夹名:
- Move "%%a" "!Str!\%Name%\"
- )
- )
复制代码
|