Skip to content

Instantly share code, notes, and snippets.

@on195594
Created January 4, 2018 10:51
Show Gist options
  • Save on195594/bacf2c94699ac39aa0a012ed5b6878b0 to your computer and use it in GitHub Desktop.
Save on195594/bacf2c94699ac39aa0a012ed5b6878b0 to your computer and use it in GitHub Desktop.
@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
pause>nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment