本帖最后由 purrpig 于 2011-3-23 15:25 编辑
前半段代码版主已经帮我改好了- @echo off&setlocal enableDelayedExpansion
- cd/d "D:\Test"
- for /d %%a in (*) do (
- set "a=%%a"
- xcopy /cqisekrh "%%a" "E:\Test\!a:~0,2!\!a:~2,2!\%%a"
- rd /s /q "%%a"
- )
复制代码 我想可能要在for里面嵌入一个判断语句
我自己瞎写的是这样的- @echo off&setlocal enableDelayedExpansion
- cd/d "D:\Test"
- for /d %%a in (*) do (
- set "a=%%a"
- if exist "E:\Test\!a:~0,2!\!a:~2,2!\%%a" (xcopy /c/q/i/s/e/k/r/h/y "E:\Test\!a:~0,2!\!a:~2,2!\%%a" "E:\Backup\%date:~0,10%\%%a"
- xcopy /c/q/i/s/e/k/r/h/y "%%a" "E:\Test\!a:~0,2!\!a:~2,2!\%%a" ) else xcopy /c/q/i/s/e/k/r/h/y "%%a" "E:\Test\!a:~0,2!\!a:~2,2!\%%a"
- pause
- )
复制代码 我知道错肯定是错的,但我想,大致样子应该是这样吧=。=|||
希望各位多多帮助下。 |