hebedich 通过本文主要向大家介绍了windows powershell,windowspowershell2.0,windows powershell64,windows10 powershell,windows7 powershell等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
管道
把上一条命令的输出作为下一条命令的输入。

PowerShell管道
例如通过ls获取当前目录的所有文件信息,然后通过Sort -Descending对文件信息按照Name降序排列,最后将排序好的文件的Name和Mode格式化成Table输出。
PS C:\PStest> ls | sort -Descending Name | Format-Table Name,Mode Name Mode ---- ---- d.txt -a--- c.txt -a--- b.txt -a--- ABC d---- a.txt -a---</div>
重定向
把命令的输出保存到文件中,‘>'为覆盖,'>>'追加。
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></div> </div>

