您现在的位置是:网站首页> 编程资料编程资料
Windows Powershell 管道和重定向_PowerShell_
2023-05-26
510人已围观
简介 Windows Powershell 管道和重定向_PowerShell_
管道
把上一条命令的输出作为下一条命令的输入。

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---
重定向
把命令的输出保存到文件中,‘>'为覆盖,'>>'追加。
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>
您可能感兴趣的文章:
相关内容
- Windows Powershell 快捷键介绍_PowerShell_
- windows Powershell 快速编辑模式和标准模式_PowerShell_
- Windows Powershell 自定义控制台_PowerShell_
- Windows Powershell 介绍和安装_PowerShell_
- Powershell学习笔记--使用正则表达式查找文件_PowerShell_
- Tornado中database模块被取消的替代方法_PowerShell_
- Powershell直接脚本时出现无法加载文件因为禁止执行脚本_PowerShell_
- PowerShell是什么?_PowerShell_
- PowerShell中正则表达式使用例子_PowerShell_
- PowerShell中调用外部程序和进程操作命令例子_PowerShell_
