本帖最后由 狂人一个 于 2012-6-7 20:31 编辑
- @echo off
- setlocal enabledelayedexpansion
- color 9f
- title 文件分类移动
- for /f %%i in ('dir /b *.') do (
- set /a p=p+1
- @echo !p!. %cd%\%%i\&&@echo !p!. %cd%\%%i\>>h.temp
- )
- set /p choice= 请选择目标文件夹:
-
- :cc
- if !choice!=="1" goto 1
- if !choice!=="2" goto 2
- if !choice!=="3" goto 3
- if !choice!=="4" goto 4
- if !choice!=="5" goto 5
- if !choice!=="6" goto 6
- if !choice!=="7" goto 7
- if !choice!=="8" goto 8
- if !choice!=="9" goto 9
- if !choice!=="0" goto end
-
-
- :1
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=2 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp&&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :2
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=3 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :3
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=4 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :4
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=5 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :5
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=6 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :6
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=7 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :7
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=8 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :8
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=9 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :9
- set /p Files= 请把要处理的文件拖曳到本窗口:
- set Files=!Files:"=!
-
- (set Files=%Files::=^" ^"% )
-
- for %%i in ("%Files%") do (
-
- set "b=%%~i"
-
- if defined last echo,!last:~-1!:!b:~0,-1!>>files.txt
-
- set "last=%%~i"
- )
- for /f "skip=10 delims=. tokens=2" %%a in ('find "!choice!." h.temp') do (
- for /f "delims=" %%A in (files.txt) do (
- move "%%A" %%a>nul
- echo.
- echo 已将%%A移动到目标文件夹了!
- )
- )
- del files.txt>nul
- echo 完成移动任务,还需要继续么?&&type h.temp &&set /p choice= 请继续选择(退出请按0):
- if not !choice!==0 goto cc
- if !choice!==0 goto end
- pause>nul
-
- :end
- del h.temp
- @echo 你没有进行选择,程序即将退出!!
- pause>nul
复制代码
|