本帖最后由 smss 于 2019-6-24 18:43 编辑
- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a /s "%1\manifest.xml"') do (set "P=%%~dpi"
- cd/d "!P!..\."
- call set "Pf=%%P:!cd!\=%%"
- echo "!P:~,-1!"复制到"%~dp0!Pf:~,-1!"
- ::xcopy /e /i /y "!P:~,-1!" "%~dp0!Pf:~,-1!"
- echo rmdir /s /q "!P:~,-1!">>"%~dp01.txt"
- echo move "%~dp0!Pf:~,-1!" "!P:~,-1!">>"%~dp02.txt")
- ::中间略过其它脚本1W条 {:3_55:}
- ::"!P:~,-1!"在循环中出现的值保存在1.txt怎样给后边使用
- ::如上我已把要处理前的文件复制另一个文件夹了
- ::需要处理文件之后删除已处理过的文件 再把处理前的原文件移动回来等同于备份
- for /f "delims=" %%a in (%~dp01.txt %~dp02.txt) do (%%a)
- pause
复制代码 感觉不够好 会生成1和2TXT 不知高手都是怎样解决的- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a /s "%1\manifest.xml"') do (set "P=%%~dpi"
- cd/d "!P!..\."
- call set "Pf=%%P:!cd!\=%%"
- xcopy /e /i /y "!P:~,-1!" "%~dp0!Pf:~,-1!"
- echo rmdir /s /q "!P:~,-1!">>"%~dp01.txt"
- echo move "%~dp0!Pf:~,-1!" "!P:~,-1!">>"%~dp02.txt")
- pause
- for /f "delims=" %%a in (%~dp01.txt) do (%%a)
- for /f "delims=" %%a in (%~dp02.txt) do (%%a)
- del "%~dp01.txt" "%~dp02.txt"
- pause
复制代码
|