{"id":1440,"date":"2008-10-21T23:39:00","date_gmt":"2008-10-21T14:39:00","guid":{"rendered":"https:\/\/hdmr.org\/d\/?e=161"},"modified":"2008-10-21T23:39:00","modified_gmt":"2008-10-21T14:39:00","slug":"blogn-161","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/?e=161","title":{"rendered":"PowerShell\u306f\u672c\u5f53\u306b\u529b\u5f37\u3044"},"content":{"rendered":"<p>Windows PowerShell\u5165\u308c\u3066\u3044\u308d\u3044\u308d\u904a\u3093\u3067\u307f\u3066\u305f\u308a\u3002<br \/>\u307e\u3041\u3057\u304b\u3057\u306a\u304b\u306a\u304b\u4f7f\u3044\u9053\u304c\u601d\u3044\u6d6e\u304b\u3070\u3093\u306a\u3041\u2026<br \/>Windows Script Host\u3092\u7f6e\u63db\u3067\u304d\u308b\u7a0b\u5ea6\u306e\u80fd\u529b\u306f\u3042\u308b\u3089\u3057\u3044\u306e\u3060\u304c\u3002<br \/>\u305d\u306e\u80cc\u666f\u3068\u3057\u3066.NET Framework\u3092\u4f7f\u3063\u3066\u52d5\u4f5c\u3057\u3066\u3044\u3066\u3001<br \/>\u3053\u308c\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3068\u3002<br \/>\u305d\u308c\u306a\u3089\u4fbf\u5229\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u304cPowerShell\u7528\u306b\u3068\u7528\u610f\u3055\u308c\u3066\u3066\u3082\u3088\u3055\u305d\u3046\u306a\u3082\u3093\u3060\u304c\u3001<br \/>\u73fe\u72b6\u3067\u306fPowerShell\u306f\u307b\u3068\u3093\u3069\u666e\u53ca\u3057\u3066\u3044\u306a\u3044\u3002<br \/>\u6700\u8fd1\u8a71\u984c\u306eWindows 7\u306b\u306f\u642d\u8f09\u3055\u308c\u305d\u3046\u3060\u3051\u3069\u306d\u3002\u307e\u3041\u305d\u308c\u306a\u3089\u666e\u53ca\u3059\u308b\u304b\u306a?<\/p>\n<hr \/>\n<p>PowerShell\u306e\u30d1\u30a4\u30d7\u3068\u3044\u3046\u306e\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u6d41\u308c\u3067\u3042\u308b\u3068\u3002<br \/>\u3053\u3093\u306a\u306e\u3092\u6295\u3052\u3066\u307f\u305f\u3002<\/p>\n<pre>dir|where{$_.Length -gt 100}|select Name,Length<\/pre>\n<p>\u3069\u3046\u898b\u3066\u3082LINQ\u3067\u3059\u3088\u306d\u3002<br \/>\u3069\u3046\u3082dir\u3068\u3044\u3046\u306e\u306fDirectoryInfo\u3068FileInfo\u306e\u914d\u5217\u3089\u3057\u3044\u3002<br \/>\u307e\u3041\u6df7\u3056\u308a\u5408\u3063\u3066\u308b\u308f\u3051\u3060\u304c\u3001\u305d\u306e\u8fba\u306f\u3042\u307e\u308a\u6c17\u306b\u3057\u306a\u304f\u3066\u3044\u3044\u3002<br \/>IEnumerable\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306bwhere\u3068\u304bselect\u3068\u304b\u304c\u3042\u308b\u3068\u3002<br \/>\u306a\u304b\u306a\u304b\u304a\u3082\u3057\u308d\u3044\u6a5f\u80fd\u3067\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u6d41\u308c\u3068\u3044\u3046\u306e\u306f\u3053\u3046\u3044\u3046\u3053\u3068\u306a\u306e\u304b\u3068\u3002<br \/>\u6587\u5b57\u5217\u306e\u6d41\u308c\u3060\u3068\u3001Length\u304c\u3069\u3046\u3060\u3068\u304b\u306a\u304b\u306a\u304b\u7c21\u5358\u306b\u51e6\u7406\u3067\u304d\u306a\u3044\u3002<br \/>\u305d\u3046\u3044\u3046\u3053\u3068\u3092\u3084\u308b\u306e\u306bPerl\u3068\u304b\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u308a\u3068\u304b\u3044\u3046\u306e\u3082\u3042\u3063\u305f\u3068\u304a\u3082\u3046\u3002<\/p>\n<pre>foreach(<*>){if(-s $_>100){printf \"%-30s %10d\\n\",$_,-s $_;}}<\/pre>\n<p>\u307e\u3041\u591a\u5c11\u9055\u3046\u304b\u3082\u77e5\u308c\u3093\u304c\u610f\u5473\u3068\u3057\u3066\u306f\u3053\u3046\u3044\u3046\u3053\u3068\u3067\u3057\u3087\u3046\u3002<\/p>\n<hr \/>\n<p>.NET Framework\u3092\u4f7f\u3063\u3066\u52d5\u4f5c\u3057\u3066\u3044\u308b\u90fd\u5408\u3053\u3046\u3044\u3046\u3053\u3068\u3060\u3063\u3066\u3067\u304d\u308b\u3002<\/p>\n<pre>$req=[System.Net.HttpWebRequest]::Create(\"http:\/\/libserver.ddo.jp\/\")<br \/>$resst=$req.GetResponse().GetResponseStream()<br \/>$streader=New-Object System.IO.StreamReader($resst)<br \/>$streader.ReadToEnd()<\/pre>\n<p>\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u306f[\u30af\u30e9\u30b9\u540d]::\u30e1\u30bd\u30c3\u30c9\u540d(\u5f15\u6570)\u3067\u547c\u3073\u51fa\u3057\u3001\u5909\u6570\u306f$\u304b\u3089\u59cb\u307e\u308b\u3002<br \/>\u305d\u308c\u3050\u3089\u3044\u3067OK\u3067\u3059\u3002<br \/>\u307e\u3041\u78ba\u304b\u306b\u3053\u3046\u3044\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u30ac\u30ea\u30ac\u30ea\u4f7f\u3046\u3082\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u3002<br \/>\u30ac\u30ea\u30ac\u30ea\u4f7f\u3044\u305f\u3044\u4eba\u306fIronPython\u3068\u304b\u4f7f\u3046\u65b9\u304c\u3088\u3055\u305d\u3046\u3002<br \/>\u307e\u3041\u305d\u308c\u306f\u305d\u3046\u306a\u3093\u3060\u304c\u3001C#\u306e\u5236\u5fa1\u69cb\u6587\u306a\u3069\u3082\u304b\u306a\u308a\u8f38\u5165\u3055\u308c\u3066\u3044\u3066\u3001<br \/>\u3084\u308d\u3046\u3068\u601d\u3048\u3070\u3044\u308d\u3044\u308d\u3067\u304d\u305d\u3046\u3067\u3059\u3002<br \/>\u3053\u3046\u3044\u3046\u98a8\u306b.NET\u306e\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u3001\u4f8b\u3048\u3070\u81ea\u52d5\u6295\u7a3f\u30b9\u30af\u30ea\u30d7\u30c8\u3068\u304b\u3001\u305d\u3046\u3044\u3046\u306e\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<br \/>\u4eca\u3067\u306fPowerShell\u304c\u307b\u3068\u3093\u3069\u666e\u53ca\u3057\u3066\u306a\u3044\u304b\u3089\u610f\u5473\u306f\u306a\u3044\u3051\u3069\u3001<br \/>\u3082\u3057\u666e\u53ca\u3059\u308c\u3070\u3044\u307e\u307e\u3067VBScript\u3068\u304b\u3067\u3084\u3063\u3066\u305f\u3053\u3068\u3082\u3053\u308c\u3067\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u308b\u3088\u3068\u3002<br \/>\u305d\u3046\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<hr \/>\n<p>\u3053\u3046\u3044\u3046\u306e\u3092\u898b\u3066\u308b\u3068Microsoft\u304c\u4f55\u3092\u3084\u308a\u305f\u304b\u3063\u305f\u306e\u304b\u3068\u3044\u3046\u306e\u304c\u898b\u3048\u3066\u304d\u305d\u3046\u3067\u3059\u3002<br \/>\u4eca\u306ecmd\u306e\u30d0\u30c3\u30c1\u306f\u3042\u307e\u308a\u9ad8\u5ea6\u306a\u51e6\u7406\u306f\u3067\u304d\u306a\u3044\u3001<br \/>Windows Script Host\u306e\u4e0a\u3067\u52d5\u304fVBScript\u3068\u304b\u3042\u308b\u3051\u3069\u306a\u304b\u306a\u304b\u308f\u304b\u308a\u306b\u304f\u3044\u3002<br \/>\u305d\u306e\u8fba\u306e\u90fd\u5408\u304c\u3042\u3063\u3066\u3001\u304d\u308c\u3044\u306b\u6574\u7406\u3057\u76f4\u3057\u305f\u306e\u304cPowerShell\u3060\u3068\u3002<br \/>cmd\u306e\u30b3\u30de\u30f3\u30c9\u985e\u306f\u30a8\u30a4\u30ea\u30a2\u30b9\u3067\u3001PowerShell\u306e\u30b3\u30de\u30f3\u30c9\u30ec\u30c3\u30c8\u306b\u95a2\u9023\u3065\u3051\u3089\u308c\u3066\u3044\u308b\u3002<br \/>\u4f8b\u3048\u3070dir\u306a\u3089Get-ChildItem\u3068\u304b\u3002\u3061\u306a\u307f\u306bls\u3082\u540c\u69d8\u3002\u8457\u540d\u306aUNIX\u7cfb\u306e\u30b3\u30de\u30f3\u30c9\u3082\u8f38\u5165\u3055\u308c\u3066\u308b\u3002<br \/>\u305d\u3057\u3066.NET\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u3053\u3068\u3067\u8907\u96d1\u306a\u3053\u3068\u3082\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\u305d\u308c\u3092\u6d3b\u7528\u3059\u308b\u305f\u3081\u306b\u30d1\u30a4\u30d7\u3092\u6d41\u308c\u308b\u306e\u306f.NET\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3057\u305f\u304b\u3089\u3001<br \/>\u4eca\u307e\u3067\u5225\u306e\u30b3\u30de\u30f3\u30c9\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u51e6\u7406\u3057\u3066\u305f\u3053\u3068\u3092\u3001Where-Object(where\u306f\u30a8\u30a4\u30ea\u30a2\u30b9)\u3068\u304b\u3067\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3068\u3002<br \/>\u306a\u304b\u306a\u304b\u898b\u6240\u3042\u308a\u305d\u3046\u3067\u3059\u306d\u3002\u666e\u53ca\u3057\u3066\u6d3b\u7528\u4f8b\u3092\u898b\u3066\u307f\u305f\u3044\u3082\u306e\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows PowerShell\u5165\u308c\u3066\u3044\u308d\u3044\u308d\u904a\u3093\u3067\u307f\u3066\u305f\u308a\u3002\u307e\u3041\u3057\u304b\u3057\u306a\u304b\u306a\u304b\u4f7f\u3044\u9053\u304c\u601d\u3044\u6d6e\u304b\u3070\u3093\u306a\u3041\u2026Windows Script Host\u3092\u7f6e\u63db\u3067\u304d\u308b\u7a0b\u5ea6\u306e\u80fd\u529b\u306f\u3042\u308b\u3089\u3057\u3044\u306e\u3060\u304c\u3002\u305d\u306e\u80cc\u666f\u3068\u3057\u3066.NET Fra [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1440","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1440"}],"version-history":[{"count":0,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1440\/revisions"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}