Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
Jerry Thomas
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Post
by Jerry Thomas » Thu Mar 20, 2014 4:15 pm
I need to check for and kill an existing process.
Normally an easy task.
My problem is the process will be called
WinMake.exe OR
WinMake20140319ahh-2.exe OR
WinMake + date + initials + iteration +.exe
Is there any way to say:
KillProcess>WinMake*.exe
Or is there a way to use the old VB technique?
Something like this?
(edited to clean up query)
Code: Select all
VBSTART
Sub killProcess
set wmi = getobject("winmgmts:")
sQuery = "select * from win32_process where name like 'WinMake'"
set processes = wmi.execquery(sQuery)
for each process in processes
process.terminate
next
End Sub
VBEND
Any ideas?
-
Jerry Thomas
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Post
by Jerry Thomas » Thu Mar 20, 2014 4:28 pm
Solved my own problem...
sQuery = "select * from win32_process where name like 'WinMake%'"
I had to add the % meaning 0 or more characters
-
CyberCitizen
- Automation Wizard
- Posts: 724
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Post
by CyberCitizen » Fri Mar 21, 2014 12:43 am
Taskkill /f /im WinMake*.exe
FIREFIGHTER
-
Jerry Thomas
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Post
by Jerry Thomas » Fri Mar 21, 2014 1:56 pm
Thanks Cyber!
That would have been much simpler....