determine version of .exe thru batch file

Here you can find everything you need to know about Dll-Files. You can also share your knowledge regarding the topic.

Moderators: DllAdmin, DLLADMIN ONLY

Post Reply
woodrg
Posts: 1
Joined: 01 Jun 2009, 23:00

determine version of .exe thru batch file

Post by woodrg »

I have been researching a way to check the version of a file thru a
batch file; i found the filever.exe utility, but then discovered it is
not compatable with Vista.

Is there a way to do this in Vista? My goal is to create a batch file
that compares the version of an .exe that is locally installed to the
"current" version on a server, replace the local version if it doesn't
match, and then open the local version.

in searching i found a command in one of the forums here (can't find
that post now to save my life!) that i believe was intended to check the
version of a dll, but in the example that was given they used an .exe -
so i was hoping to get it to work for me, but i'm getting errors.

Here's what i'm trying:
$env:"C:\Program Files\ProgramFolder\Program.exe".VersionInfo |
fl *
and here's what i'm getting:
The filename, directory name, or volume label syntax is
incorrect.
Help with this method or the correct method would be GREATLY
appreciated!

thanks in advance!

Rebekah
Ft. Rucker


--
woodrg

jon
Posts: 6
Joined: 06 Apr 2009, 23:00

Re: determine version of .exe thru batch file

Post by jon »

"woodrg" <guest@unknown-email.com> wrote in message
news:aaa81b15813aad49e67f5ea66c62ddbb@nntp-gateway.com...
>
> I have been researching a way to check the version of a file thru a
> batch file; i found the filever.exe utility, but then discovered it is
> not compatable with Vista.
>
> Is there a way to do this in Vista? My goal is to create a batch file
> that compares the version of an .exe that is locally installed to the
> "current" version on a server, replace the local version if it doesn't
> match, and then open the local version.
>
> in searching i found a command in one of the forums here (can't find
> that post now to save my life!) that i believe was intended to check the
> version of a dll, but in the example that was given they used an .exe -
> so i was hoping to get it to work for me, but i'm getting errors.
>
> Here's what i'm trying:
> $env:"C:\Program Files\ProgramFolder\Program.exe".VersionInfo |
> fl *
> and here's what i'm getting:
> The filename, directory name, or volume label syntax is
> incorrect.
> Help with this method or the correct method would be GREATLY
> appreciated!
>
> thanks in advance!
>




The code you've got there looks like Powershell code, rather than cmd.exe
code, so it won't work as is in a cmd.exe shell.

If you've installed Powershell (a free download) then you can do something
like

(Get-Command "$env:ProgramFiles\Windows
Sidebar\sidebar.exe").FileVersionInfo.FileVersion

which looks similar to the code you posted. Example output .......

PS (1) > (Get-Command "$env:ProgramFiles\Windows
Sidebar\sidebar.exe").FileVersionInfo.Fil
eVersion
6.0.6000.16615 (vista_gdr.071215-2230)
PS (2) >


Alternatively if you're keen on batch files, then filever.exe seems to work
ok here with Vista and cmd.exe. I don't know what particular issues you're
having ......

"D:\Program Files\Support Tools\filever.exe" /d "C:\Program Files\Windows
Sidebar\sidebar.exe"

--a-- W32i APP ENU 6.0.6000.16615 shp sidebar.exe


--
Jon

Post Reply