I think I can do ya one better
If WMIC is available (should be all Windows OS except XP Home):
Code: Select all
wmic process where name="abc.exe" call terminate
wmic process where name="def.exe" call terminate
Or somewhat of a combination of the three of us, to support all:
Code: Select all
@echo off
(echo:set a=getobject("winmgmts:"^)
echo:set b=a.execquery("select * from win32_process where name='"+wscript.arguments(0^)+"' or name='"+wscript.arguments(1^)+"'"^)
echo:for each c in b
echo:c.terminate
echo:next
)>"%temp%\terminate.vbs"
cscript "%temp%\terminate.vbs" //nologo "abc.exe" "def.exe"
del "%temp%\terminate.vbs"
pause
exit
I use cscript because: Command Prompt needs to wait for it to terminate (ie the VBScript to finish), and any kind of error output is directed to the console instead of in an annoying pop-up. I also chose to keep the use of arguments so it can be re-used in the same script, but modify as desired.
This is just cutting down WMI scripts as I detailed at the bottom here:
viewtopic.php?f=3&t=1815&p=7223&hilit=url#p7223...and reposted here:
viewtopic.php?f=3&t=1875&p=7763#p7763alan_b wrote:This is an inappropriate post which is termed a hijack.
You really should start again by creating your own topic with a relevant title for many reasons :-
1. Almost no one who has the ability to answer your question will study a lengthy topic which is outside their knowledge;
2. Absolutely no one who also needs this information will study a long topic that is totally unrelated to their needs;
3. many forums have a strict policy that requests for information should be via the public forum, and their experts should not have their time wasted with private message requests that cause the experts to needlessly waste their time repeating the same information to everyone who wants their exclusive attention.
lol you're replying to a bot, alan_b. But for the sake of the somehow relevant-to-DOS question despite being a hi-jack, some commands are ping, tracert and ipconfig /all.