{"id":2356,"date":"2020-12-11T08:27:16","date_gmt":"2020-12-10T23:27:16","guid":{"rendered":"https:\/\/www.oqiita.com\/?p=2356"},"modified":"2020-12-11T15:41:25","modified_gmt":"2020-12-11T06:41:25","slug":"%e3%80%90powershell%e3%80%91%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ae%e6%96%87%e5%ad%97%e3%82%b3%e3%83%bc%e3%83%89%e5%8f%96%e5%be%97","status":"publish","type":"post","link":"https:\/\/www.oqiita.com\/?p=2356","title":{"rendered":"\u3010PowerShell\u3011\u30d5\u30a1\u30a4\u30eb\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u53d6\u5f97"},"content":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u3092\u8abf\u3079\u308b\u65b9\u6cd5\u3002<\/p>\n<p><!--more--><\/p>\n<p><\/p>\n<h3 id=\"i-0\">\u30d5\u30a1\u30a4\u30eb\u306e\u53d6\u5f97<\/h3>\n<p>\u6700\u521d\u306fPowerShell\u3060\u3051\u3067\u3067\u304d\u308b\u3068\u601d\u3063\u3066\u516c\u958b\u3057\u305f\u3051\u3069\u3001\u7121\u7406\u307d\u3060\u3063\u305f\u3002<br \/>\n\u306a\u306e\u3067DLL\u3092\u8ffd\u52a0\u3057\u3066\u3001\u305d\u308c\u3092PowerShell\u304b\u3089\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3067\u3002<br \/>\n  <a class=\"reference table\" href=\"https:\/\/github.com\/hnx8\/ReadJEnc\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n    <span class=\"tbcell refttl\">\u53c2\u8003<\/span><br \/>\n    <span class=\"tbcell refcite\">GitHub \u2013 hnx8\/ReadJEnc: ReadJEnc C#(.NET)\u7528\u30d5\u30a1\u30a4\u30eb\u6587\u5b57\u30b3\u30fc\u30c9\u7a2e\u985e\u81ea\u52d5\u5224\u5225\u30e9\u30a4\u30d6\u30e9\u30ea<span>github.com<\/span><\/span><br \/>\n  <\/a><\/p>\n<p><a href=\"https:\/\/github.com\/hnx8\/ReadJEnc\/releases\" rel=\"noopener noreferrer\" target=\"_blank\">\u30ea\u30ea\u30fc\u30b9\u30da\u30fc\u30b8<\/a>\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.oqiita.com\/wp-content\/uploads\/2020\/12\/ReadJEnc.png\" alt=\"\" width=\"887\" height=\"462\" class=\"alignnone size-full wp-image-2519\" srcset=\"https:\/\/www.oqiita.com\/wp-content\/uploads\/2020\/12\/ReadJEnc.png 887w, https:\/\/www.oqiita.com\/wp-content\/uploads\/2020\/12\/ReadJEnc-300x156.png 300w, https:\/\/www.oqiita.com\/wp-content\/uploads\/2020\/12\/ReadJEnc-768x400.png 768w\" sizes=\"auto, (max-width: 887px) 100vw, 887px\"><\/p>\n<p>Zip\u3092\u89e3\u51cd\u3057\u3066DLL\u3092\u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\u306b\u914d\u7f6e\u3002<br \/>\n\u30d0\u30fc\u30b8\u30e7\u30f3\u6bce\u306bDLL\u304c\u5165\u3063\u3066\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u9069\u5f53\u306a\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b.NET Framework\u306e\u78ba\u8a8d\u306f\u2193\u3092\u53c2\u8003\u306b<br \/>\n<a href=\"https:\/\/qiita.com\/asterisk9101\/items\/f13da78b4cb9ab6d3c4b\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/qiita.com\/asterisk9101\/items\/f13da78b4cb9ab6d3c4b<\/a><\/p>\n<h3 id=\"i-1\">\u6587\u5b57\u30b3\u30fc\u30c9\u78ba\u8a8d<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-batch\"># DLL\u3092\u8aad\u307f\u8fbc\u307f\n[Reflection.Assembly]::LoadFile(\"C:\\TEMP\\Hnx8.ReadJEnc.dll\")\n\n$file=Get-Item \"C:\\TEMP\\test.txt\"\n$reader=new-object Hnx8.ReadJEnc.FileReader($file )\n$reader.Read($file)<\/code><\/pre>\n<h5 id=\"i-2\">\u5b9f\u884c\u7d50\u679c<\/h5>\n<pre class=\"line-numbers\"><code class=\"language-batch\">Name  CodePage\n----  --------\nASCII        0<\/code><\/pre>\n<h3 id=\"i-3\">\u6587\u5b57\u30b3\u30fc\u30c9\u78ba\u8a8d\u3000\u4e00\u62ec<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-batch\"># DLL\u3092\u8aad\u307f\u8fbc\u307f\n[Reflection.Assembly]::LoadFile(\"C:\\TEMP\\Hnx8.ReadJEnc.dll\")\n\n$targetFolder = 'C:\\TEMP\\TEST\\';\nforeach($item in Get-ChildItem $targetFolder)\n{\n    if($item.PSIsContainer)\n    {\n        # \u30d5\u30a9\u30eb\u30c0\u306e\u5834\u5408\u306e\u51e6\u7406\n    }\n    else\n    {\n        # \u30d5\u30a1\u30a4\u30eb\u306e\u5834\u5408\u306e\u51e6\u7406\n        $file=Get-Item $item.FullName\n        $reader=new-object Hnx8.ReadJEnc.FileReader($file)\n        #$reader.Read($file)\n        Write-Host ($file.Name + \"`t`t\" + $reader.Read($file).Name);\n    }\n} <\/code><\/pre>\n<h5 id=\"i-4\">\u5b9f\u884c\u7d50\u679c<\/h5>\n<pre class=\"line-numbers\"><code class=\"language-batch\">1.txt\t\tShiftJIS\n2.txt\t\tASCII\n3.txt\t\tUTF-8N\n4.txt\t\tUTF-8\n<\/code><\/pre>\n<p>\u203bUTF-8 \u21d2 BOM\u4ed8 UTF-8 \u3063\u307d\u3044<\/p>\n<h3 id=\"i-5\">\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u3082<\/h3>\n<p>Get-ChildItem \u306b -Recurse \u3064\u3051\u308c\u3070\u884c\u3051\u308b\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-batch\">foreach($item in Get-ChildItem $targetFolder -Recurse)<\/code><\/pre>\n<p>\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u3092\u8abf\u3079\u308b\u65b9\u6cd5\u3002<\/p>\n","protected":false},"author":1,"featured_media":748,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[268],"tags":[292],"class_list":{"0":"post-2356","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-powershell","8":"tag-292","9":"entry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.oqiita.com\/wp-content\/uploads\/2017\/12\/sango_powershell_icatch.png","jetpack_shortlink":"https:\/\/wp.me\/p8QluP-C0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts\/2356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2356"}],"version-history":[{"count":7,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts\/2356\/revisions"}],"predecessor-version":[{"id":2518,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts\/2356\/revisions\/2518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/media\/748"}],"wp:attachment":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}