I need to be able to kill a process using some sort of batch file

M

myk

(insert subject). The thing is, the PID changes with each launch.

At my work, we use a remote control utility that, for some reason,
doesn't kill the process every time we choose "Exit" from the File
menu. So, we have to go into the task manager and kill the process. Is
there any easy way to do this?

I don't have access to any dev tools, I can't use any external apps
(downloaded), so I'm kind of restricted to any Windows function or DOS
..bat file or something that can perform this. As I said, the PID
changes every time we launch the app, but the image name is always the
same and unique in this environment.

Thanks in advance.
 
P

Paul R. Sadowski [MVP]

See tskill and taskkill whichever you may have.

You can also use WMI in a VBS script Just make sure your work is saved
before running any of these.

Example:
' killOutlook.vbs
set wmi = getobject("winmgmts:")
wql = "select * from Win32_Process " & " where name='outlook.exe'"
set results = wmi.execquery(wql)
for each app in results
app.terminate
next
 
D

Dave Patrick

Also this one.

http://www.sysinternals.com/ntw2k/freeware/pskill.shtml

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| (insert subject). The thing is, the PID changes with each launch.
|
| At my work, we use a remote control utility that, for some reason,
| doesn't kill the process every time we choose "Exit" from the File
| menu. So, we have to go into the task manager and kill the process. Is
| there any easy way to do this?
|
| I don't have access to any dev tools, I can't use any external apps
| (downloaded), so I'm kind of restricted to any Windows function or DOS
| .bat file or something that can perform this. As I said, the PID
| changes every time we launch the app, but the image name is always the
| same and unique in this environment.
|
| Thanks in advance.
 
M

myk

Paul R. Sadowski said:
See tskill and taskkill whichever you may have.

You can also use WMI in a VBS script Just make sure your work is saved
before running any of these.

Example:
' killOutlook.vbs
set wmi = getobject("winmgmts:")
wql = "select * from Win32_Process " & " where name='outlook.exe'"
set results = wmi.execquery(wql)
for each app in results
app.terminate
next

the code worked perfectly. thanks!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top