Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Kill all applications.

20 Dec 2009   #1
Kevlar

Windows 7 Ultimate RC Build 7100
 
 
Kill all applications.

Hello, I am in the process of making a batch file but it needs to be able to close all open applications. I know I can use the kill command but that only works for designated applications. What i need is for it to close all possible applications.


I'm sorry if that wasn't clear.

Any suggestions would be great

Thanks


My System SpecsSystem Spec
.
20 Dec 2009   #2
Dzomlija

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Kevlar View Post
Hello, I am in the process of making a batch file but it needs to be able to close all open applications. I know I can use the kill command but that only works for designated applications. What i need is for it to close all possible applications.


I'm sorry if that wasn't clear.

Any suggestions would be great

Thanks
Which command are you using (or trying to use) to kill applications? Because this is what I get at a command prompt when I type KILL

Code:
 
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Users\Peter Dzomlija>kill
'kill' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Peter Dzomlija>
My System SpecsSystem Spec
20 Dec 2009   #3
Digi

windows 7 ultimate
 
 

i dont think its easy to do that as some application run more than 2 process and some under system (that is if you group them by user and system and local) such as some anti virus programs
My System SpecsSystem Spec
.

20 Dec 2009   #4
ccatlett1984

 

you cant kill "all" processes and not have it kill windows processes as well. why would you need to kill unknown processes to run your script? what are you trying to do with your script?
My System SpecsSystem Spec
20 Dec 2009   #5
Kevlar

Windows 7 Ultimate RC Build 7100
 
 

Im sorry guys/girls, i meant the TASKKILL command.

Quote   Quote: Originally Posted by Digi View Post
i dont think its easy to do that as some application run more than 2 process and some under system (that is if you group them by user and system and local) such as some anti virus programs
Even if a program runs more than one process, shouldnt closing the program stop all processes having to do with that program?
My System SpecsSystem Spec
20 Dec 2009   #6
Kevlar

Windows 7 Ultimate RC Build 7100
 
 

Quote   Quote: Originally Posted by ccatlett1984 View Post
you cant kill "all" processes and not have it kill windows processes as well. why would you need to kill unknown processes to run your script? what are you trying to do with your script?
In Task Manager, there is a "Application" tab and a "Processes" tab.
What Im looking for is something to close all applications, not process having nothing to do with those applications.
My System SpecsSystem Spec
20 Dec 2009   #7
Dzomlija

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Kevlar View Post
Quote   Quote: Originally Posted by ccatlett1984 View Post
you cant kill "all" processes and not have it kill windows processes as well. why would you need to kill unknown processes to run your script? what are you trying to do with your script?
In Task Manager, there is a "Application" tab and a "Processes" tab.
What Im looking for is something to close all applications, not process having nothing to do with those applications.
I've been looking into it a bit more, and all I can come up with is the TASKKILL command, and though it allow wildcards, it can't kill all processes:

Code:
TASKKILL [/S system [/U username [/P [password]]]]
         { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Description:
    This tool is used to terminate tasks by process id (PID) or image name.
Parameter List:
    /S    system           Specifies the remote system to connect to.
    /U    [domain\]user    Specifies the user context under which the
                           command should execute.
    /P    [password]       Specifies the password for the given user
                           context. Prompts for input if omitted.
    /FI   filter           Applies a filter to select a set of tasks.
                           Allows "*" to be used. ex. imagename eq acme*
    /PID  processid        Specifies the PID of the process to be terminated.
                           Use TaskList to get the PID.
    /IM   imagename        Specifies the image name of the process
                           to be terminated. Wildcard '*' can be used
                           to specify all tasks or image names.
    /T                     Terminates the specified process and any
                           child processes which were started by it.
    /F                     Specifies to forcefully terminate the process(es).
    /?                     Displays this help message.
Filters:
    Filter Name   Valid Operators           Valid Value(s)
    -----------   ---------------           -------------------------
    STATUS        eq, ne                    RUNNING |
                                            NOT RESPONDING | UNKNOWN
    IMAGENAME     eq, ne                    Image name
    PID           eq, ne, gt, lt, ge, le    PID value
    SESSION       eq, ne, gt, lt, ge, le    Session number.
    CPUTIME       eq, ne, gt, lt, ge, le    CPU time in the format
                                            of hh:mm:ss.
                                            hh - hours,
                                            mm - minutes, ss - seconds
    MEMUSAGE      eq, ne, gt, lt, ge, le    Memory usage in KB
    USERNAME      eq, ne                    User name in [domain\]user
                                            format
    MODULES       eq, ne                    DLL name
    SERVICES      eq, ne                    Service name
    WINDOWTITLE   eq, ne                    Window title
    NOTE
    ----
    1) Wildcard '*' for /IM switch is accepted only when a filter is applied.
    2) Termination of remote processes will always be done forcefully (/F).
    3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote
       machine is specified.
Examples:
    TASKKILL /IM notepad.exe
    TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
    TASKKILL /F /IM cmd.exe /T
    TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
    TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
    TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
    TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
My System SpecsSystem Spec
20 Dec 2009   #8
TimStitt

Windows 7 Ultimate 64 bit
 
 

Hi Kevlar,

This should be possible using a For /f command that checks tasklist and uses 'TASKKILL /F /IM program.exe /T' on the results.

Have a go at it and let me know if you get stuck and I'll try to put it together for you. Batching is my forte
My System SpecsSystem Spec
20 Dec 2009   #9
Kevlar

Windows 7 Ultimate RC Build 7100
 
 

Thanks alot!! it works like a charm
My System SpecsSystem Spec
20 Dec 2009   #10
ccatlett1984

 

for a list of the running applications, you can use powershell

Code:
 
Set Word = CreateObject("Word.Application")
Set Tasks = Word.Tasks
For Each Task in Tasks
If Task.Visible Then Wscript.Echo Task.Name 
Next 
Word.Quit
I'm still wondering what purpose this script serves?
My System SpecsSystem Spec
Reply

 Kill all applications.




Thread Tools




Similar help and support threads
Thread Forum
Did I kill my SSD?
Hi guys, Does anybody know if it's possible to kill an SSD by plugging it into a potentially faulty SATA/IDE to USB 2.0 adapter?: one of these things: http://img.dxcdn.com/productimages/sku_147893_1.jpg - I wanted to plug the SSD externally to my laptop to transfer all my files but I just...
Hardware & Devices
High CPU usage (100%) on Random applications. (Applications using 50%)
https://www.youtube.com/watch?v=l6JT-3CJMeI Lately I've been experiencing High CPU usage on random application. It's becoming really annoying and cutting down my productivity on already slow, crappy laptop. I've tried everything: *Virus Scans *ProcessExplorer (and all solutions related to it)...
Performance & Maintenance
How to kill DEP?
Heya, i have some problems with DEP(doesnt allow some app to work(dllhost.exe), but i can't to disable it, even through cmd(bcdedit.exe /set {current} nx AlwaysOff), and exceptions doesn't work because after restart, DEP is always "Turn on DEP for essential Windows programs and services only", so...
System Security
Kill process with cmd
What would be the command to kill a process like explorer.exe or wininit.exe through cmd?
Performance & Maintenance
Did M$ just kill my key!? Can't activate...
Hi! I just built a new computer and installed Win7 Home Premium (bought from amazon, not OEM version) on it and when i tried to activate it online an error came up telling me "The product key you typed cannot be used to activate Windows on this computer.". And i'm like WTF!?, i thought you could...
Windows Updates & Activation
Pinning applications to other applications?
I like the new taskbar, but I find it getting a little cluttered with all of the applications I use on a regular basis (thus warranting pinning them to the taskbar). Being kind of OCD, this bugs me as when I open programs that aren't pinned to the toolbar for a little bit (games, the various...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 13:39.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App