set file=update.xml set ver=0.0.0.0 set url=http://172.16.17.97:8999 echo ^<?xml version="1.0" encoding="utf-8" ?^> >%file% echo ^<item^>>>%file% rem 这里读取exe的版本号到临时再转格式再输出到 %file% wmic datafile where Name=$(TargetDir)\$(TargetFileName) get Version >%temp%\\b.txt PowerShell -Command "& {get-content %temp%\\b.txt -encoding utf8 | set-content %temp%\\2.txt -encoding ascii}" setlocal enabledelayedexpansion for /f "delims=[" %%i in (%temp%\\2.txt) do ( echo %%i| findstr "Version" >nul || echo ^<version^>%%i^</version^>>>%file% set ver=%%~nxi ) echo ^<url^>%url%/ZtgeoGISDesktop_%ver%.Zip^</url^>>>%file% echo ^<changelog^>%url%/update.html ^<^/changelog^>>>%file% echo ^</item^>>>%file% start %file%