Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Retrieving VersionInfo for a list of file

Reply
 
Old 10-06-2008   #1 (permalink)
Pete Zerger (MVP)


 
 

Retrieving VersionInfo for a list of file


I am trying to retrieve the file version information for a list of files
(unsuccessfully). The objective is to find the version information on a
list of file in a single user-defined path. In this sample, I'm attempting
to retrieve the version of these files in the c:\windows\system32 directory,
where installpath is the directory where the files are found.

Should I be using foreach to repeat steps for each file in the list?


#------------Begin script sample


param(
[string] $installpath = $(Throw "installpath required.") #required parameter
)

$files = $installpath + "\dfrgsnap.dll",$installpath + "\dfrgui.dll",$installpath
+ "\dfsshlex.dll"

dir $files | format-list VersionInfo


#------------End script sample

Regards,

Pete Zerger, MCSE(Messaging) | MCTS(SQL 2005) | MCTS(Opsmgr) | MVP - Opsmgr
URL:http://www.systemcenterforum.org
User Group: http://www.systemcenterusergroup.com
MP Catalog: http://www.systemcenterforum.org/mps



My System SpecsSystem Spec
Old 10-06-2008   #2 (permalink)
Shay Levy [MVP]


 
 

Re: Retrieving VersionInfo for a list of file

Hello Pete,


Enclose the file paths with ():

$files = ($installpath + "\dfrgsnap.dll"),($installpath + "\dfrgui.dll"),($installpath
+ "\dfsshlex.dll")


Or let powershell expand $installpath:

$files = "$installpath\dfrgsnap.dll","$installpath\dfrgui.dll","$installpath\dfsshlex.dll"




---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar


PZ> I am trying to retrieve the file version information for a list of
PZ> files (unsuccessfully). The objective is to find the version
PZ> information on a list of file in a single user-defined path. In this
PZ> sample, I'm attempting to retrieve the version of these files in the
PZ> c:\windows\system32 directory, where installpath is the directory
PZ> where the files are found.
PZ>
PZ> Should I be using foreach to repeat steps for each file in the list?
PZ>
PZ> #------------Begin script sample
PZ>
PZ> param(
PZ> [string] $installpath = $(Throw "installpath required.")
PZ> #required parameter
PZ> )
PZ> $files = $installpath + "\dfrgsnap.dll",$installpath +
PZ> "\dfrgui.dll",$installpath + "\dfsshlex.dll"
PZ>
PZ> dir $files | format-list VersionInfo
PZ>
PZ> #------------End script sample
PZ>
PZ> Regards,
PZ>
PZ> Pete Zerger, MCSE(Messaging) | MCTS(SQL 2005) | MCTS(Opsmgr) | MVP -
PZ> Opsmgr
PZ> URL:http://www.systemcenterforum.org
PZ> User Group: http://www.systemcenterusergroup.com
PZ> MP Catalog: http://www.systemcenterforum.org/mps


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can the "now playing" list be retrieved if a file is accedentally opened, losing list Media Center
Retrieving file count from a list of child folders PowerShell
File Names Not Sorted Properly In File List Vista file management
Re: HOW TO: Modify the way a file list looks. PowerShell
Include shared folder/file in "save" file list Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46