Take the 2-minute tour ×

I have a batch file from a vendor to patch some software on a Vista machine. I'm going to be using GPO to push it out as a startup script.

My problem is some systems require this software and some don't.

I'd like to add code to the beginning of the script to look for the existence of an exe, and pull the string that's viewable if you right click the exe, details tab, "Product version" field.

Please suggest other solutions as comments. I know about other ways to handle this and have a couple lined up. I'm open to suggestions but would prefer all answers be to this specific question. Can it be done, if yes, how?

Thanks! -Mathew

share|improve this question

2 Answers 2

You're going to need a utility called filever which ships as a support tool with Windows. Here's a page detailing it's options.

In a batch file you would likely use it like this:

@SET APPVER=3.14159
@\\FILESHARE\filever.exe "C:\PATH\TO\YOUR\APP.EXE" | findstr /i %APPVER% > nul
  • The first line checks for the existance of your application.
  • The second line sets the version number you want to patch to
  • The third line utilizes the filever tool from MS and the built-in findstr tool to determine what version they are currently running and compare it to the version you want them to run
  • The fourth line tells them to skip running Update.exe if they are already at the correct version
  • The fifth line runs the update for people who need to be patched
  • The last line is the GOTO point referenced above and ends the batch
share|improve this answer

You could do it pretty easily with Powershell. Something like:

if ([System.Diagnostics.FileVersionInfo]::GetVersionInfo("PathToExe").FileVersion -eq "") {

This checks the fileversion and if it matches your desired version it'll execute your batch file.

share|improve this answer

Your Answer


