xml 文件如下:
\Reports \Help Terminal ..\License
修改 InstallationType 标签的值
@echo offchcp 65001setlocal EnableDelayedExpansionset anotherVariable=kb-a-%date:~8,2%%date:~11,2%(for /F "delims=" %%a in (file.xml) do ( set "line=%%a" set "newLine=!line:InstallationType>=!" if "!newLine!" neq "!line!" ( set "newLine=%anotherVariable% " ) echo !newLine!)) > newFile.xml
以上代码会修改 InstallationType 标签的值为 kb-a-0319,另存到文件 newFile.xml
参考链接: