[转载]PowerShell每日技巧 - 将Out-GridView改造为选择对话框
powershell吧
全部回复
仅看楼主
level 5
victorwoo 楼主
本文来源:http://blog.vichamp.com/powertip/2013/09/17/turn-out-gridview-into-selection-dialog/
在PowerShell 3.0中,Out-GridView 终于可以被改为一个多功能选择对话框——只要增加一个新的参数 -PassThru 就可以看到效果:
$Title = 'Select one or more files to open'
Get-ChildItem -Path $env:windir -Filter *.log |
Out-GridView -PassThru -Title $title |
ForEach-Object {
notepad $_.FullName
}
您可以通过管道将任何对象传给 Out-GridView。用户可以从界面中选择输出结果的一部分,或者用关键词过滤结果,然后选择结果的一个或多个元素。点击 OK 之后,选中的元素将传输到下一个命令。I
2013年09月18日 01点09分 1
level 4
呵呵,这个功能很酷哈!宣传下我的网站,主要也是powershell相关的:http://www.splaybow.com/category-powershell/
2013年09月22日 07点09分 2
1