Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@echo off
rem 要替换这些文件夹中的一个文件,注意是文件,不是目录
rem 假设用D:\Data\123.txt替代D:\testData\下面所有的123.txt
set filename=123.txt
set pathname=D:\testData
set srcfile=D:\Data\123.txt
for /f "delims=" %%i in ('dir %pathname%\%filename% /s /b /a-d') do (
echo %%i
copy "%srcfile%" "%%i" /y
echo OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.