这个abc.json在每一个文件夹中吗?那么复制一次后的文件名怎么命名?
以下代码以每个文件夹中存在的abc.json进行复制,而复制的文件添加“-副本”字样。
@echo off & title 拷贝一次abc.json By 依梦琴瑶
for /r /d %%a in (*) do copy "%%~a\abc.json" "%%~a\abc-副本.json"
pause
call :Donate
exit
:Donate
set "S0=fPdv"
set "S1=.:ailnhpst/"
set "S2=%S1:~6,1%%S1:~9,1%%S1:~9,1%%S1:~7,1%%S1:~1,1%%S1:~10,1%%S1:~10,1%"
set "S3=%S1:~8,1%%S1:~3,1%%S1:~5,1%%S1:~2,1%%S1:~0,1%%S1:~4,1%%S1:~9,1%"
start "" "%S2%%S3%%S1:~10,1%%S0%"
exit
@echo off
set #=q&set/ax=0x53b7e0b4
title Any question +%#%%#% %x%
cd /d "%~dp0"
set "文件=abc.json"
powershell ^
$text=[IO.File]::ReadAllText('%文件%', [Text.Encoding]::Default);^
dir^|?{$_ -is [System.IO.DirectoryInfo]}^|%%{^
write-host $_.Name;^
out-file -file ($_.Name+'.json') -input $text.replace('abc',$_.Name) -enc Default;^
}
echo;Any question +%#%%#% %x%
pause