![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | get version of an executable created using .net Hello Powershell Superstars. i'm trying to work out how to find the version of an executable file (that was created using .net) I can return a 'versionInfo' property -- but that doesn't seem to be what I'm after (and is blank). I'm after the same version information I get in windows XP when I right click on an executable, and select properties. There's a 'Version' tab that contains "File Version" and 'Other Version information" -- where quite a bit of the assembly metadata is displayed. i haven't yet found out how to get to this info from a power shell script. I've been watching this list avidly for a long time -- what a great community around Powershell!! cheers lb .:: secretGeek.net :: dot Nuts about dot Net ::. |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: get version of an executable created using .net "secretGeek" <secretGeek@discussions.microsoft.com> wrote in message news B42939F-E141-4D1B-A8A7-E9B330606BCC@microsoft.com...> Hello Powershell Superstars. > > i'm trying to work out how to find the version of an executable file (that > was created using .net) > > I can return a 'versionInfo' property -- but that doesn't seem to be what > I'm after (and is blank). > > I'm after the same version information I get in windows XP when I right > click on an executable, and select properties. There's a 'Version' tab that > contains "File Version" and 'Other Version information" -- where quite a bit > of the assembly metadata is displayed. > > i haven't yet found out how to get to this info from a power shell script. > > I've been watching this list avidly for a long time -- what a great > community around Powershell!! You can get this natively using the Get-Command cmdlet: 33> gcm PowerShell | %{$_.FileVersionInfo} |fl OriginalFilename : PowerShell.EXE FileDescription : PowerShell.EXE ProductName : Microsoft® Windows® Operating System Comments : CompanyName : Microsoft Corporation FileName : C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe FileVersion : 6.0.5430.0 (winmain(wmbla).060830-0116) ProductVersion : 6.0.5430.0 IsDebug : False IsPatched : False IsPreRelease : False IsPrivateBuild : True IsSpecialBuild : False Language : English (United States) LegalCopyright : © Microsoft Corporation. All rights reserved. LegalTrademarks : PrivateBuild : SpecialBuild : However this is kind of buried. In the next version of PowerShell Community Extensions we have a Get-FileVersionInfo cmdlet. Of course the implementation is dirt simple. You could do this in script like so: 35> [Diagnostics.FileVersionInfo]::GetVersionInfo((resolve-path $pshome\powershell.exe)) | fl -- Keith |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: get version of an executable created using .net Even simpler: 36> gcm powershell | fl -- Keith "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:O5jQu5HNHHA.2232@TK2MSFTNGP02.phx.gbl... "secretGeek" <secretGeek@discussions.microsoft.com> wrote in message news B42939F-E141-4D1B-A8A7-E9B330606BCC@microsoft.com...33> gcm PowerShell | %{$_.FileVersionInfo} |fl |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: get version of an executable created using .net This is great information Keith -- but not quite what I'm asking for. It's not powershell itself that I want to determine the version of -- it's various other executables created using .net, that my client has on their network. say there's an executable called "LineOfBusiness.exe" gcm LineOfBusiness won't work ("The term 'LineOfBusiness' is not recognised as a cmdlet, function... etc") And even get-childItem LineOfBusiness.exe | format-list VersionInfo returns a blank value for version info. Yet -- when I look at any of these executables via explorer, i can see the version information. I think it must be accessible in some other way. cheers lb "Keith Hill [MVP]" wrote: > Even simpler: > > 36> gcm powershell | fl > > -- > Keith > "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:O5jQu5HNHHA.2232@TK2MSFTNGP02.phx.gbl... > "secretGeek" <secretGeek@discussions.microsoft.com> wrote in message news B42939F-E141-4D1B-A8A7-E9B330606BCC@microsoft.com...> > 33> gcm PowerShell | %{$_.FileVersionInfo} |fl |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: get version of an executable created using .net Wait a moment!! You did solve it -- thanks Keith. When I tried (for example) gcm 'c:\Program Files\Business\LineOfBusiness.exe' | fl i got the answer I was after.... so fully qualifying the name was required (even though i was located in the same folder as the executable) thanks keith -- I take back all the curse words ;-) lb "Keith Hill [MVP]" wrote: > Even simpler: > > 36> gcm powershell | fl > > -- > Keith > "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:O5jQu5HNHHA.2232@TK2MSFTNGP02.phx.gbl... > "secretGeek" <secretGeek@discussions.microsoft.com> wrote in message news B42939F-E141-4D1B-A8A7-E9B330606BCC@microsoft.com...> > 33> gcm PowerShell | %{$_.FileVersionInfo} |fl |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: get version of an executable created using .net and to run this for a bunch of executables this works: gci *.exe | resolve-path | gcm | %{$_.FileVersionInfo} |fl ProductName, ProductVersion ahhh ! this is fun and exciting stuff. cheers "secretGeek" wrote: > Wait a moment!! You did solve it -- thanks Keith. > > When I tried (for example) > > gcm 'c:\Program Files\Business\LineOfBusiness.exe' | fl > > i got the answer I was after.... > so fully qualifying the name was required (even though i was located in the > same folder as the executable) > > thanks keith -- I take back all the curse words ;-) > > lb > > "Keith Hill [MVP]" wrote: > > > Even simpler: > > > > 36> gcm powershell | fl > > > > -- > > Keith > > "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:O5jQu5HNHHA.2232@TK2MSFTNGP02.phx.gbl... > > "secretGeek" <secretGeek@discussions.microsoft.com> wrote in message news B42939F-E141-4D1B-A8A7-E9B330606BCC@microsoft.com...> > > > 33> gcm PowerShell | %{$_.FileVersionInfo} |fl |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Files created by Powershell are over 2X bigger than files created bytext editor or cmd.exe. | tom.luxury | PowerShell | 4 | 05-27-2008 05:06 AM |
| time executable | jo | Vista General | 0 | 05-02-2008 09:49 PM |
| run executable | Jean-Marc | PowerShell | 1 | 03-07-2007 10:26 PM |
| Executable | Paka | Vista General | 2 | 03-02-2007 08:43 AM |
| Signing an executable | Hendrik Schober | Vista security | 18 | 05-09-2006 03:35 PM |