![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | get file version information So I want to find the version of a file in Powershell. How can I do this? I don't see a fileversion property on the system.io.fileinfo object returned from get-childitem. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: get file version information Ryan wrote: Quote: > So I want to find the version of a file in Powershell. How can I do this? I > don't see a fileversion property on the system.io.fileinfo object returned > from get-childitem. get-childitem some_file|get-member Then try: (get-childitem some_file).VersionInfo Or: get-childitem some_file|foreach-object{$_.VersionInfo} Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: get file version information Try this: ls $env:windir explorer.exe | % {$_.VersionInfo.FileVersion} #...or ([System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:winDir\explorer.exe")).FileVersion -- Kiron |
My System Specs![]() |
| | #4 (permalink) |
| | Re: get file version information Didn't mean to intrude. Marco already answered, my post was too late, just ignore it. Thanks ![]() -- Kiron |
My System Specs![]() |
| | #5 (permalink) |
| | Re: get file version information Kiron wrote: Quote: > Didn't mean to intrude. Marco already answered, my post was too late, just ignore it. Thanks ![]() > answer that... So your answer is better! ;-) Marco |
My System Specs![]() |
| | #6 (permalink) |
| | Re: get file version information Hi Marco, As an example, if I want to see the version on ntfs.sys I try: (get-item 'c:\windows\system32\drivers\ntfs.sys').VersionInfo It returns nothing for me. I tried what Kiron wrote too and no luck. Ryan "Marco Shaw [MVP]" wrote: Quote: > Ryan wrote: Quote: > > So I want to find the version of a file in Powershell. How can I do this? I > > don't see a fileversion property on the system.io.fileinfo object returned > > from get-childitem. > Not everything shows up by default, try: > get-childitem some_file|get-member > > Then try: > (get-childitem some_file).VersionInfo > > Or: > get-childitem some_file|foreach-object{$_.VersionInfo} > > Marco > > -- > Microsoft MVP - Windows PowerShell > http://www.microsoft.com/mvp > > PowerGadgets MVP > http://www.powergadgets.com/mvp > > Blog: > http://marcoshaw.blogspot.com > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: get file version information Hi Ryan, Did you try the second part of what Kiron wrote? i.e. [System.Diagnostics.FileVersionInfo]::GetVersionInfo('C:\Windows\System32\drivers\ntfs.sys').FileVersion This is necessary because the version information is not included as a member of the file objects in PowerShell. If you're doing this for a lot of files, you could add it as a member for all of them by doing this: Get-ChildItem C:\Windows\System32\Drivers | Add-Member -Name FileVersion -MemberType ScriptProperty -Value {[System.Diagnostics.FileVersionInfo]::GetVersionInfo($this.FullName).FileVersion} -PassThru | Format-Table -Property Name,FileVersion -- Kirk Munro Poshoholic http://poshoholic.com "Ryan" <Ryan@xxxxxx> wrote in message news:A15F5E98-5E76-4FAE-83FB-764C8FAEE5B8@xxxxxx Quote: > Hi Marco, > > As an example, if I want to see the version on ntfs.sys I try: > > (get-item 'c:\windows\system32\drivers\ntfs.sys').VersionInfo > > It returns nothing for me. I tried what Kiron wrote too and no luck. > > Ryan > > "Marco Shaw [MVP]" wrote: > Quote: >> Ryan wrote: Quote: >> > So I want to find the version of a file in Powershell. How can I do >> > this? I >> > don't see a fileversion property on the system.io.fileinfo object >> > returned >> > from get-childitem. >> Not everything shows up by default, try: >> get-childitem some_file|get-member >> >> Then try: >> (get-childitem some_file).VersionInfo >> >> Or: >> get-childitem some_file|foreach-object{$_.VersionInfo} >> >> Marco >> >> -- >> Microsoft MVP - Windows PowerShell >> http://www.microsoft.com/mvp >> >> PowerGadgets MVP >> http://www.powergadgets.com/mvp >> >> Blog: >> http://marcoshaw.blogspot.com >> |
My System Specs![]() |
| | #8 (permalink) |
| | Re: get file version information Ryan wrote: Quote: > Hi Marco, > > As an example, if I want to see the version on ntfs.sys I try: > > (get-item 'c:\windows\system32\drivers\ntfs.sys').VersionInfo > > It returns nothing for me. I tried what Kiron wrote too and no luck. > > Ryan Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #9 (permalink) |
| | Re: get file version information "Ryan" <Ryan@xxxxxx> wrote in message news:C3614ADE-85D2-4999-A4FB-272B72389C90@xxxxxx Quote: > So I want to find the version of a file in Powershell. How can I do this? > I > don't see a fileversion property on the system.io.fileinfo object returned > from get-childitem. e.g. PS> (gcm powershell).FileVersionInfo.FileVersion 6.0.6000.16386 (winmain(wmbla).070112-1312) Or if you have PSCX installed: PS> Get-FileVersionInfo C:\Windows\system32\user32.dll ProductVersion FileVersion FileName -------------- ----------- -------- 6.0.6000.16386 6.0.6000.1638... C:\Windows\system32\user32.dll -- Keith http://www.codeplex.com/powershellcx |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Retrieve file version information | PowerShell | |||
| File version information? | Vista General | |||
| Version information in Explorer's File Details Tab | Vista file management | |||
| File version information limited in Windows Explorer on Vista | Vista General | |||
| Where to save trial version information? | Vista General | |||