07/12/12 23:11:58
scriptname = "foo.vbs"
set swl = wscript.createobject("wbemscripting.swbemlocator")
set s = swl.connectserver
set rs = s.execquery("select * from win32_process where caption='cscript.exe' or caption='wscript.exe'")
p = -1
for each r in rs
if instr(1, r.commandline, scriptname) then
wscript.echo r.caption
p = r.parentprocessid
end if
next
set rs = s.execquery("select * from win32_process where processid=" & p)
for each r in rs
wscript.echo r.caption
next
'URLリンク(d.hatena.ne.jp)