{"id":11035,"date":"2018-11-08T15:00:57","date_gmt":"2018-11-08T06:00:57","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=11035"},"modified":"2018-11-08T17:39:20","modified_gmt":"2018-11-08T08:39:20","slug":"%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%9f%e3%83%95%e3%82%a9%e3%83%ab%e3%83%80%e5%86%85%e3%81%a7%e6%9c%80%e3%82%82%e6%9b%b4%e6%96%b0%e6%97%a5%e6%99%82%e3%81%ae%e6%96%b0%e3%81%97%e3%81%84%e3%83%95%e3%82%a1","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=11035","title":{"rendered":"\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u6700\u3082\u66f4\u65b0\u65e5\u6642\u306e\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308bVBScript"},"content":{"rendered":"<p>\u5927\u91cf\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u6700\u65b0\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u7c21\u5358\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nDim Args\r\n\r\nSet Args = WScript.Arguments\r\nIf Args.Count &lt; 1 Then WScript.Quit\r\nIf CreateObject(&quot;Scripting.FileSystemObject&quot;).FolderExists(Args(0)) = False Then WScript.Quit\r\nWScript.Echo GetRecentlyModifiedFile(Args(0))\r\n\r\nPrivate Function GetRecentlyModifiedFile(ByVal FolderPath)\r\n'\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u6700\u3082\u66f4\u65b0\u65e5\u6642\u306e\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u53d6\u5f97\r\n  Dim fs, f\r\n  Dim d\r\n  Dim ret\r\n  \r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    Set fs = .GetFolder(FolderPath).Files\r\n    If fs.Count &gt; 0 Then\r\n      For Each f In fs\r\n        If d &lt; f.DateLastModified Then\r\n          ret = f.Path\r\n          d = f.DateLastModified\r\n        End If\r\n      Next\r\n    End If\r\n  End With\r\n  GetRecentlyModifiedFile = ret\r\nEnd Function<\/pre>\n<p>\u5f15\u6570\u3068\u3057\u3066\u6e21\u3055\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u66f4\u65b0\u65e5\u6642\u3092\u9806\u756a\u306b\u898b\u3066\u3044\u3063\u3066\u3001\u6700\u3082\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u8fd4\u3059\u3060\u3051\u306e\u7c21\u5358\u306a\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p>\u3064\u3044\u3067\u306b\u3001\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u66f4\u65b0\u65e5\u6642\u3092\u4e00\u89a7\u8868\u793a\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3082\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3053\u3061\u3089\u306f\u30ec\u30b3\u30fc\u30c9\u30bb\u30c3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u5f62\u306b\u5909\u66f4\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nDim Args\r\n\r\nSet Args = WScript.Arguments\r\nIf Args.Count &lt; 1 Then WScript.Quit\r\nIf CreateObject(&quot;Scripting.FileSystemObject&quot;).FolderExists(Args(0)) = False Then WScript.Quit\r\nListRecentlyModifiedFiles Args(0)\r\n\r\nPrivate Sub ListRecentlyModifiedFiles(ByVal FolderPath)\r\n'\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u66f4\u65b0\u65e5\u6642\u9806\u3067\u5217\u6319\r\n  Dim rs, fs, f\r\n  Const adWChar = 130\r\n  Const adDBTimeStamp = 135\r\n  \r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    Set fs = .GetFolder(FolderPath).Files\r\n    If fs.Count &gt; 0 Then\r\n      '\u30ec\u30b3\u30fc\u30c9\u30bb\u30c3\u30c8\u8a2d\u5b9a\r\n      Set rs = CreateObject(&quot;ADODB.Recordset&quot;)\r\n      rs.Fields.Append &quot;ModifyDate&quot;, adDBTimeStamp, 255\r\n      rs.Fields.Append &quot;Path&quot;, adWChar, 255\r\n      rs.Open\r\n      \r\n      For Each f In fs\r\n        rs.AddNew\r\n        rs.Fields(&quot;ModifyDate&quot;).Value = f.DateLastModified\r\n        rs.Fields(&quot;Path&quot;).Value = f.Path\r\n        rs.Update\r\n      Next\r\n      \r\n      rs.Sort = &quot;ModifyDate DESC&quot; '\u66f4\u65b0\u65e5\u6642\u3067\u964d\u9806\u30bd\u30fc\u30c8\r\n      rs.MoveFirst\r\n      \r\n      Do Until rs.EOF\r\n        WScript.Echo rs.Fields(&quot;ModifyDate&quot;).Value &amp; vbTab &amp; rs.Fields(&quot;Path&quot;).Value\r\n        rs.MoveNext\r\n      Loop\r\n      \r\n      rs.Close\r\n    End If\r\n  End With\r\nEnd Sub<\/pre>\n<p>\u3053\u3053\u307e\u3067\u66f8\u3044\u3066\u304a\u3044\u3066\u4f55\u3067\u3059\u304c\u3001<a href=\"https:\/\/tech.nikkeibp.co.jp\/it\/free\/NT\/WinKeyWord\/20040805\/1\/dir.shtml\" title=\"Windows\u30b3\u30de\u30f3\u30c9\u96c6\uff1a\uff08dir\uff09\" target=\"_blank\">dir<\/a>\u30b3\u30de\u30f3\u30c9(dir \/O:-D)\u3067\u4f3c\u305f\u3088\u3046\u306a\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u308f\u3056\u308f\u3056\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f\u5fc5\u8981\u306f\u306a\u304b\u3063\u305f\u3067\u3059\u306d&#x1f4a6;<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"\u5927\u91cf\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u6700\u65b0\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u7c21\u5358\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002 Option Explicit Dim Args Set Args = WScript.Arguments If A [&hellip;]","protected":false},"author":1,"featured_media":7132,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_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":[6],"tags":[],"class_list":["post-11035","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vbs"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-VBScript.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2RZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11035"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11035\/revisions"}],"predecessor-version":[{"id":11036,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11035\/revisions\/11036"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7132"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}