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