{"id":1916,"date":"2020-09-10T10:28:20","date_gmt":"2020-09-10T01:28:20","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=1916"},"modified":"2020-09-10T10:28:20","modified_gmt":"2020-09-10T01:28:20","slug":"post-1916","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2020\/09\/10\/post-1916\/","title":{"rendered":"VBS\u3067\u306e\u5f15\u6570\u306e\u6e21\u3057\u65b9\u3068\u53c2\u7167\u65b9\u6cd5"},"content":{"rendered":"<h2>VBS\u3067\u306e\u5f15\u6570\u306e\u6e21\u3057\u65b9\u3068\u53c2\u7167\u65b9\u6cd5<\/h2>\n<p>\u30b7\u30b9\u30c6\u30e0\u5316\u3092\u9032\u3081\u3066\u3044\u304f\u4e2d\u3067\u3001\u5fc5\u305a\u5fc5\u8981\u3068\u306a\u308b\u306e\u304c\u3010\u5171\u901a\u6a5f\u80fd(\u5171\u901a\u52d5\u4f5c)\u306e\u5207\u308a\u51fa\u3057\u3011\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306b\u306f\u5f15\u6570\u3068\u3057\u3066\u305d\u306e\u6642\u5909\u6570\u306b\u5165\u3063\u3066\u3044\u308b\u5024\u3092\u6e21\u3059\u52d5\u4f5c\u304c\u307b\u307c\u30bb\u30c3\u30c8\u3067\u3064\u3044\u3066\u56de\u308a\u307e\u3059\u3002<\/p>\n<p>VBS\u3067\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u6210\u3057\u3066\u3044\u304f\u306b\u3042\u305f\u308a\u3001\u500b\u4eba\u7684\u306b\u4e0a\u624b\u304f\u3067\u304d\u306a\u304b\u3063\u305f\u65b9\u6cd5\u3092\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30cf\u30cd\u3089\u308c\u305f\u5171\u901a\u51e6\u7406\u306b\u3064\u3044\u3066<\/h3>\n<div class=\"paperBox\">\n<ol>\n<li>\u5225\u30d5\u30a1\u30a4\u30eb\u306b\u5206\u3051\u305fVBScript\u306eFunction\u90e8\u306e\u547c\u51fa\u3057<\/li>\n<li>\u30ab\u30f3\u30de\u306e\u5165\u308b\u5f15\u6570\u306e\u5f15\u304d\u6e21\u3057<\/li>\n<li>\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3( \u2019 )\u306e\u5165\u3063\u305f\u5f15\u6570\u306e\u5f15\u304d\u6e21\u3057<\/li>\n<li>\u30b9\u30da\u30fc\u30b9\u306e\u5165\u308b\u5f15\u6570\u306e\u5f15\u304d\u6e21\u3057<\/li>\n<li>\u5f15\u6570\u3092( )\u3067\u56f2\u3046\u3068\u30a8\u30e9\u30fc<\/li>\n<\/ol>\n<\/div>\n<p>\u305d\u308c\u305e\u308c\u306b\u5bfe\u51e6\u65b9\u6cd5\u306f\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5225\u30d5\u30a1\u30a4\u30eb\u306eFunction\u3092\u547c\u3073\u51fa\u3059\u306b\u306f\u3001\u5225\u30d5\u30a1\u30a4\u30eb\u5185\u3067Call\u3057\u305f\u308asub\u306a\u3069\u306bFunction\u3092\u547c\u3073\u51fa\u3059\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u7f6e\u3051\u3070OK\u3067\u3059\u3002\u3053\u306e\u6642\u3001\u5225\u30d5\u30a1\u30a4\u30eb\u3078\u30d5\u30e9\u30b0\u3068\u306a\u308b\u5f15\u6570\u3092\u6e21\u3057\u3066\u7f6e\u3051\u3070\u300c\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u6765\u305f\u304b\u300d\u3067\u306e\u52d5\u4f5c\u5909\u66f4\u3082\u7d44\u3081\u307e\u3059\u3002<\/p>\n<p>\u79c1\u306fFunction\u3092\u76f4\u63a5\u547c\u3073\u51fa\u305d\u3046\u3068\u601d\u3063\u3066\u533a\u5206\u3051\u3092\u3057\u3066\u3044\u305f\u306e\u3067\u3053\u308c\u306b\u306f\u3084\u3089\u308c\u307e\u3057\u305f\u3002<br \/>\n\u79c1\u304c\u77e5\u8b58\u4e0d\u8db3\u306a\u3060\u3051\u3067\u4f55\u304b\u3084\u308a\u65b9\u306f\u3042\u308b\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u304c...\u3002<\/p>\n<h3>\u5177\u4f53\u4f8b<\/h3>\n<pre class=\"lang:default decode:true\">'OK\u306a\u4f8b\r\n\u3000\u2019\u5225\u30d5\u30a1\u30a4\u30eb\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8aad\u307f\u8fbc\u3080\r\n  objAct.Run (\"activeCh.vbs iexplore.exe\")\r\n\u3000\r\n  'activeCh.vbs\u4e2d\u8eab\r\n  '------------------------------\r\n   Option Explicit\r\n     Dim strIEexe\r\n     Dim intProcID\r\n\r\n     strIEexe = Wscript.Arguments(0)\r\n\r\n     'sub\u3092\u52d5\u304b\u3059\r\n     call ActiveIE\r\n\r\n\u3000\u3000\u3000'\u25bcsub\u4e2d\u8eab\r\n     sub ActiveIE()\r\n       Dim objWshShell\r\n       'Function\u3092\u52d5\u304b\u3059\r\n       GetProcID(strIEexe)\r\n       If intProcID = 0 Then\r\n          WScript.Quit(0) \r\n          Exit Sub\r\n       End If\r\n    \r\n       Set objWshShell = WScript.CreateObject(\"WScript.Shell\")\r\n       objWshShell.AppActivate intProcID\r\n       Set objWshShell = Nothing\r\n     End Sub\r\n\r\n    '\u25bcFunction\u4e2d\u8eab\r\n     Function GetProcID(ProcessName)\r\n      Dim Service\r\n      Dim QfeSet\r\n      Dim Qfe\r\n\r\n      Set Service = WScript.CreateObject(\"WbemScripting.SWbemLocator\").ConnectServer\r\n      Set QfeSet = Service.ExecQuery(\"Select * From Win32_Process Where Caption='\"&amp; ProcessName &amp;\"'\")\r\n\r\n      intProcID = 0\r\n\r\n      For Each Qfe in QfeSet\r\n          intProcID = Qfe.ProcessId\r\n          Exit For\r\n      Next\r\n\r\n      GetProcID = intProcID &lt;&gt; 0\r\n  End Function\r\n  '------------------------------\r\n\r\n'NG\u306a\u4f8b \u203bhoge=&gt;function\u540d\r\n  objAct.Run (\"activeCh.vbs::hoge iexplore.exe\")\r\n  objAct.Run (\"activeCh.vbs(hoge) iexplore.exe\")\r\n  objAct.Run (\"activeCh.vbs[hoge] iexplore.exe\")\r\n  objAct.Run (\"activeCh.vbs hoge iexplore.exe\")<\/pre>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u307e\u3041\u90f7\u306b\u5165\u3063\u3066\u306f\u90f7\u306b\u5f93\u3048\u3067\u3057\u304b\u306a\u3044\u306e\u3067\u899a\u3048\u3066\u56de\u907f\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u3082\u306a\u3041\uff5e\u3001\u306a\u3093\u304b\u3084\u308a\u65b9\u306f\u3042\u308b\u3068\u601d\u3046\u3093\u3060\u3088\u306a\u3041\uff5e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VBS\u3067\u306e\u5f15\u6570\u306e\u6e21\u3057\u65b9\u3068\u53c2\u7167\u65b9\u6cd5 \u30b7\u30b9\u30c6\u30e0\u5316\u3092\u9032\u3081\u3066\u3044\u304f\u4e2d\u3067\u3001\u5fc5\u305a\u5fc5\u8981\u3068\u306a\u308b\u306e\u304c\u3010\u5171\u901a\u6a5f\u80fd(\u5171\u901a\u52d5\u4f5c)\u306e\u5207\u308a\u51fa\u3057\u3011\u3067\u3059\u3002 \u3053\u308c\u306b\u306f\u5f15\u6570\u3068\u3057\u3066\u305d\u306e\u6642\u5909\u6570\u306b\u5165\u3063\u3066\u3044\u308b\u5024\u3092\u6e21\u3059\u52d5\u4f5c\u304c\u307b\u307c\u30bb\u30c3\u30c8\u3067\u3064\u3044\u3066\u56de\u308a\u307e\u3059\u3002 VBS\u3067\u30b7\u30b9\u30c6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1923,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_jetpack_feature_clip_id":0,"_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},"jetpack_post_was_ever_published":false},"categories":[689],"tags":[],"class_list":["post-1916","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wsh-vbs"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2020\/09\/image.png","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=1916"}],"version-history":[{"count":0,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1916\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/1923"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=1916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=1916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=1916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}