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