例如通过ls获取当前目录的所有文件信息,然后通过Sort -Descending对文件信息按照Name降序排列,最后将排序好的文件的Name和Mode格式化成Table输出。
PS C:\PStest> "Powershell Routing" >test.txt
PS C:\PStest> Get-Content .\test.txt
Powershell Routing
PS C:\PStest> "Powershell Routing" >>test.txt
PS C:\PStest> "Powershell Routing" >>test.txt
PS C:\PStest> "Powershell Routing" >>test.txt
PS C:\PStest> "Powershell Routing" >>test.txt
PS C:\PStest> "Powershell Routing" >>test.txt
PS C:PStest\&; Get-Content .\test.txt
Powershell Routing
Powershell Routing
Powershell Routing
Powershell Routing
Powershell Routing
Powershell Routing
PS C:\PStest>