| Richard's profileRichard Siddaway's BlogPhotosBlogLists | Help |
|
July 19 Sorting a hash tableThere is a really good PowerShell script for working with indexed files - scans or photos and renumbering to cope with missing numbers available from http://www.tellingmachine.com/post/2008/07/Renaming-a-series-of-indexed-files-with-Powershell.aspx One point at the end of the post is about sorting hash tables. This is not intuitive as piping the hash table into sort does not work. You need to use the GetEnumerator() before trying to sort like this PS> $a = @{} Name Value PS> $a.getEnumerator() | Sort Key -Descending Name Value PS> $a.getEnumerator() | Sort Name -Descending Name Value Create a hash table as shown. Use the getEnumerator() method and pipe into sort. Sorted!
Technorati Tags: PowerShell TrackbacksThe trackback URL for this entry is: http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1551.trak Weblogs that reference this entry
|
|
|