# Listing 2: FileInfo2.ps1 # Assign the results from FileInfo.cmd to the variable. $fileInfo = c:\scripts\fileinfo.cmd # Send the variable's output down the pipeline. $fileInfo | # Filter out all files except the "current" files. where-object { $_ -like "*current*.txt" } | # Sort collection in descending order by filename. sort-object { $_.substring(39) } -descending | # Retrieve the filename from each item in the collection. # Display the filename in uppercase letters. foreach-object { write-host $_.substring(39).toUpper() }