>>400 '子の親(=自分)を調べる方法でgetpid()を作ってるサイトがあったので 'そちらを参考(丸写しともいう)にして >>302 を改良 'ttp://www.vector.co.jp/soft/winnt/util/se420729.html 'ttp://www.vector.co.jp/soft/winnt/util/se383755.html set swl = wscript.createobject("wbemscripting.swbemlocator") set s = swl.connectserver set rs = s.execquery("select * from win32_process where processid=" & getpid()) for each r in rs wscript.echo r.caption p = r.parentprocessid set prs = s.execquery("select * from win32_process where processid=" & p) for each g in prs wscript.echo g.caption next next function getpid() set ws = createobject("wscript.shell") set e = ws.exec("mshta.exe -") p = e.processid set o = getobject("winmgmts:root\cimv2") set ps = o.execquery("select * from win32_process where processid=" & p) if ps.count <> 1 then e.terminate err.raise 9 end if for each p in ps getpid=p.parentprocessid next e.terminate end function