![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | How to sort a hashtable? A have a hashtable: PS I:\> $hash = @{ aaa = "one"; bbb = "two"; ccc = "three"} PS I:\> $hash Name Value ---- ----- bbb two aaa one ccc three How can I get it sorted by Name? -- Tibor |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to sort a hashtable? Try: $hash.GetEnumerator() | sort-object name -- Tom ---------------------------------------------------- Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS SQL Server MVP Toronto, ON Canada https://mvp.support.microsoft.com/profile/Tom.Moreau "Tibor Soos" <TiborSoos@xxxxxx> wrote in message news:ECAC8108-1853-408A-8301-8B9B671B6B59@xxxxxx A have a hashtable: PS I:\> $hash = @{ aaa = "one"; bbb = "two"; ccc = "three"} PS I:\> $hash Name Value ---- ----- bbb two aaa one ccc three How can I get it sorted by Name? -- Tibor |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How to sort a hashtable? Thanks! That works. Could you explain me, why this does not work without the ".GetEnumertor()"? What this function really do? -- Tibor "Tom Moreau" wrote: Quote: > Try: > > $hash.GetEnumerator() | sort-object name > > -- > Tom > > ---------------------------------------------------- > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS > SQL Server MVP > Toronto, ON Canada > https://mvp.support.microsoft.com/profile/Tom.Moreau > > > "Tibor Soos" <TiborSoos@xxxxxx> wrote in message > news:ECAC8108-1853-408A-8301-8B9B671B6B59@xxxxxx > A have a hashtable: > > PS I:\> $hash = @{ aaa = "one"; bbb = "two"; ccc = "three"} > PS I:\> $hash > > Name Value > ---- ----- > bbb two > aaa one > ccc three > > How can I get it sorted by Name? > -- > Tibor > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How to sort a hashtable? Check out: http://www.microsoft.com/technet/scr...pstip0914.mspx -- Tom ---------------------------------------------------- Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS SQL Server MVP Toronto, ON Canada https://mvp.support.microsoft.com/profile/Tom.Moreau "Tibor Soos" <TiborSoos@xxxxxx> wrote in message news:64B1A95C-4534-4FA7-BD8E-FB35DC83F69E@xxxxxx Thanks! That works. Could you explain me, why this does not work without the ".GetEnumertor()"? What this function really do? -- Tibor "Tom Moreau" wrote: Quote: > Try: > > $hash.GetEnumerator() | sort-object name > > -- > Tom > > ---------------------------------------------------- > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS > SQL Server MVP > Toronto, ON Canada > https://mvp.support.microsoft.com/profile/Tom.Moreau > > > "Tibor Soos" <TiborSoos@xxxxxx> wrote in message > news:ECAC8108-1853-408A-8301-8B9B671B6B59@xxxxxx > A have a hashtable: > > PS I:\> $hash = @{ aaa = "one"; bbb = "two"; ccc = "three"} > PS I:\> $hash > > Name Value > ---- ----- > bbb two > aaa one > ccc three > > How can I get it sorted by Name? > -- > Tibor > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| array or hashtable | PowerShell | |||
| Re: Can I sort within a sort, in folder view (eg., Name, Date) | Live Mail | |||
| Sort by name doesnt sort correctly in my opinion | Vista file management | |||
| Filter a hashtable? | PowerShell | |||
| Sorting a hashtable | PowerShell | |||