vbscript - Get a process path with VBS -
i want kill process vbs, know command :
oshell.run "taskkill /im software.exe", , true
how software.exe path before kill ?
because want launch software.exe again.
wmi (can teminate well):
dim wmi, list, process, path, shell set wmi = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2") set list = wmi.execquery("select * win32_process") '// or "select * win32_process name = 'xxxxxxx.exe'" allowing removal of if block each process in list if (lcase(process.name) = "xxxxxxx.exe") path = process.executablepath process.terminate() exit end if next wscript.echo path set shell = createobject("wscript.shell") shell.run path
Comments
Post a Comment