初めてのPowerShell
newpopsさんを師匠と仰ぎつつ、PowerShellに挑戦
http://d.hatena.ne.jp/newpops/
とりあえず、Linuxから移ってきて一番初めに悩んだ、
パイプ処理を書いてみる。
Linux、UNIX出身としてはShellの手軽さ、強力さは大好きなのだ
例題は、過去の投稿でやりたいといってた、
「あるプロセスが、つかんでるファイルの特定」
http://www.cs.gogo-asp.net/blogs/cayce/archive/2006/04/06/480.aspx
「Sleipnir.exeが掴んでいるファイルの一覧を出力」
openfiles | where { $_ -like "*Sleipnir.exe*" }
↓出力結果
12 Sleipnir.exe C:\Program Files\Fenrir & Co\Sleipnir\bin
28 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
60 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
76 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
176 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
184 Sleipnir.exe C:\..\Content.IE5\index.dat
204 Sleipnir.exe C:\..\f002014\Cookies\index.dat
212 Sleipnir.exe C:\..\History\History.IE5\index.dat
480 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
544 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
548 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
620 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
812 Sleipnir.exe C:\..\Microsoft\IMJP9_0\imjp9u.dic
940 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
1020 Sleipnir.exe C:\..\MSHist012006090520060906\index.dat
1048 Sleipnir.exe C:\WINDOWS\system32\mshtml.tlb
1104 Sleipnir.exe C:\..\8LAB0DQR\sleipnir.excite.co[1].htm
1476 Sleipnir.exe C:\WINDOWS\system32\Macromed\Flash\Flash8b.ocx
1484 Sleipnir.exe C:\WINDOWS\system32\stdole2.tlb
1504 Sleipnir.exe C:\WINDOWS\system32\iepeers.dll
1576 Sleipnir.exe C:\..6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
1632 Sleipnir.exe C:\..\Content.IE5\GJPB2I79\powershell02_02[1].htm
詳しくは、以下参照
http://www.atmarkit.co.jp/fdotnet/special/powershell02/powershell02_02.html