问题
Can any body tell me how to stop (few) selected running program/software using batch file (.bat) in windows 7 64bit?
My requirement is simple : I've set utorrent and few download manager program to run on windows startup. usually I need it in that way... but sometimes I need to stop all those download managers along with utorrent in order to gain internet browsing speed. Now I have to close all those programs manually one by one...!!! I want to make it easy.... if I can use some commands to stop those programmes in just 1 step, using a batch file, that would be great....!!!
回答1:
FIrst, get the process id with TASKLIST
tasklist /fi "imagename eq java.exe"
output :
Image Name PID Session Name Session# Mem Usage Status
=================== ====== ============= ======== ============
Java.exe 1060 RDP-Tcp#8 0 81 408 Ko
the use TASKKILL <pid>
taskkill /pid 1060
or directly
taskkill /F /FI "IMAGENAME eq java.exe"
ref : Kill process from command line
回答2:
Look at the Windows 7 cmd utililty called Taskkill. You may pass it the name of the .exe that you want to terminate.
http://forum.thewindowsclub.com/windows-tips-tutorials-articles/29463-kill-processes-using-command-prompt-windows-7-8-a.html
回答3:
You can create the list of tasks that have to be closed using a batch file as shown below. E.g.:
taskkill /im notepad++.exe
taskkill /im eclipse.exe
taskkill /im outlook.exe
taskkill /im chrome.exe
taskkill /im word.exe
taskkill /im winscp.exe
taskkill /im iexplore.exe
taskkill /im OUTLOOK.exe
taskkill /im WINWORD.exe
来源:https://stackoverflow.com/questions/16487579/how-to-stop-running-programs-on-windows-7-with-batch-commands