2

I want to sort a list of strings in powershell, but when I attempt to do so I get a result that is not sorted at all.

  PS C:\Windows\system32> "bbb", "aaa", "ccc" | sort
    bbb
    ccc
    aaa

Am I doing something wrong?

0

1 Answer 1

5

Try to be sure to use the good CmdLet:

"bbb", "aaa", "ccc" | Sort-Object

Works for me:

aaa
bbb
ccc

Then try to verify your alias:

PS> Get-Alias sort

CommandType     Name                                       Version    Source
-----------     ----                                       -------    ------
Alias           sort -> Sort-Object
Sign up to request clarification or add additional context in comments.

1 Comment

sort is an alias for sort-object so I get the same result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.