Kill all applications.


  1. Posts : 48
    Windows 7 Ultimate RC Build 7100
       #1

    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 Computer


  2. Posts : 1,261
    Windows 7 Professional 32-bit SP1
       #2

    Kevlar said:
    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 Computer


  3. Posts : 32
    windows 7 ultimate
       #3

    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 Computer


  4. Posts : 795
    windows 7 RTM x64
       #4

    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 Computer


  5. Posts : 48
    Windows 7 Ultimate RC Build 7100
    Thread Starter
       #5

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

    Digi said:
    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 Computer


  6. Posts : 48
    Windows 7 Ultimate RC Build 7100
    Thread Starter
       #6

    ccatlett1984 said:
    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 Computer


  7. Posts : 1,261
    Windows 7 Professional 32-bit SP1
       #7

    Kevlar said:
    ccatlett1984 said:
    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 Computer


  8. Posts : 1,020
    Windows 7 Ultimate 64 bit
       #8

    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 Computer


  9. Posts : 48
    Windows 7 Ultimate RC Build 7100
    Thread Starter
       #9

    Thanks alot!! it works like a charm
      My Computer


  10. Posts : 795
    windows 7 RTM x64
       #10

    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 Computer


 

  Related Discussions
Our Sites
Site Links
About 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 23:33.
Find Us