A few days ago I needed to retrieve the version information of an Winforms application and append it to some files. I needed to do this via a batch script. I did it with the following script:
@echo off setlocal for /F "delims=" %%i in ( 'findstr /C:"<Assembly: AssemblyFileVersion" ".\My App\My Project\AssemblyInfo.vb"' ) do set MyAppVersion=%%i set MyAppVersion=%MyAppVersion:~32,-4% pushd .\MyAppSetup\Release\ move /Y setup.exe setup_v%FCVersion%.exe move /Y MyAppsetup.msi MyAppsetup_v%FCVersion%.msi popd endlocal
Nice, isn’t it?