VBscriptでフォルダを開く、閉じる
もっといい方法があるんだろうけど、とりあえず開いて閉じるからいいでしょ。
ウィンドウのタイトルにフォルダ名が表示されている場合に限るが
ショートカット(Alt + F4)を使って閉じてみた。
やはり、UWSCでフォルダを開く〜閉じるより手間掛かるよな。
option explicit dim o_sfo, o_wss dim f_path, w_title, r_folder set o_sfo = createobject("scripting.filesystemobject") set o_wss = createobject("wscript.shell") f_path = "C:\test\test" 'フォルダのパス if o_sfo.folderexists(f_path) then o_wss.run f_path w_title = o_sfo.getbasename(f_path) 'フォルダの名前を取得 wscript.sleep 3000 '3秒待機 r_folder = o_wss.appactivate(w_title) if r_folder = true then o_wss.sendkeys "%{F4}" 'アクティブにできた場合にAlt+F4で閉じる set o_sfo = nothing set o_wss = nothing