本帖最后由 狄钦dQ 于 2019-1-5 17:02 编辑
- @echo off&setlocal enabledelayedexpansion
- set "SourcePath=C:\Users\DELL\Desktop\TestFolder\"
- set "DestinePath=D:\TestFolder\"
- call :count %SourcePath%
- for /f "delims=" %%a in ('dir /a-d /s /b %SourcePath%') do (
- set "file=%%~fa"
- set "RelativePath=!file:~%n%!"
- REM echo "%DestinePath%!RelativePath!" )
- echo F | xcopy "%%~fa" "%DestinePath%!RelativePath!" /D /Y)
- )
- pause&exit
- :count
- set p=%1
- for /l %%b in (0 1 8192) do (
- if "!p:~%%b,1!"=="" (set "n=%%b"&goto :eof))
复制代码
|