本帖最后由 caruko 于 2011-9-15 12:09 编辑
- @echo off&setlocal ENABLEDELAYEDEXPANSION
- set "rpath=d:\xyz"
- for /r "%rpath%" %%a in (*) do (
- set "p=%%~dpa"
- set "p=!p:%rpath%=!"
- call :change "%%a!p:\=" "!"&&rmdir "%%~dpa" 2>nul
- )
- pause>nul
- goto :eof
-
- :change
- if not %~3.==. (
- set "name=%~n1"
- set "name=!name:~0,4!"
- set newname=%~3@!name!%~x1
- echo,move %1 "%rpath%\%~2\!newname!"
- exit /b 0
- )
- exit /b 1
复制代码
|