x@echo offsetlocal enabledelayedexpansionecho 备份到U盘:for /f %%i in (%~dp0saveFile.txt) do set "pt=%%i"&echo %%i&call :getname %%i&xcopy "!pt!\*.*" "E:\备份\信息备份\!fn!\" /s /h /d /c /Ypauseexit:getnameset "fn=%~nx1"
x
@echo off
setlocal enabledelayedexpansion
echo 备份到U盘:
for /f %%i in (%~dp0saveFile.txt) do set "pt=%%i"&echo %%i&call :getname %%i&xcopy "!pt!\*.*" "E:\备份\信息备份\!fn!\" /s /h /d /c /Y
pause
exit
:getname
set "fn=%~nx1"
需要在同级目录创建记录文件路径的文件:
saveFile.txt
内容:
D:\aaa\bbb