bat 获取 exe 文件中 产品版本号并存储到变量中

set EXE='D:\gitlab\drivereasy3\DriverEasyWPF\bin\Release\DriverEasy.exe'
powershell "(Get-Item -path %EXE%).VersionInfo.ProductVersion" > DE_Version_tmp.txt
for /f "tokens=*" %%i in (DE_Version_tmp.txt) do (
    setlocal disabledelayedexpansion
    set version=%%i
    setlocal enabledelayedexpansion
)
del DE_Version_tmp.txt
echo %version%
pause

 

 

posted @ 2019-07-02 12:05  Ryan_zheng  阅读(3239)  评论(0编辑  收藏  举报