How to use TASKKILL for 32 bit applications in Windows 64 bit environment?

7,664

You can use TASKLIST to get the PID by Window title, process name, or other criteria like this:

tasklist /FI "WINDOWTITLE eq notepad"

This will list all processes which of which the window name equals "notepad".

Example output:

C:\windows\system32>tasklist /FI "WINDOWTITLE eq Untitled - Notepad"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
notepad.exe                   1876 Console                    1      7,156 K

The available filters are:

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
    SESSIONNAME     eq, ne                    Session name
    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
    SERVICES        eq, ne                    Service name
    WINDOWTITLE     eq, ne                    Window title
    MODULES         eq, ne                    DLL name

Then you can use taskkill and provide the PID.

TASKKILL /PID 1230 /PID 1241 /PID 1253 /T

/t terminates the processes and its childs, /PID specifies the process ID.

If you have powershell available you can use Stop-Process <pid> (eg Stop-Process 3512) or Stop-Process -processname notepad

More information is available here on the Stop-Process command.

It would be very useful if you provided the OS name on which you encounter the issue, it's highly unusual that names are truncated to DOS-STYLE in 64 bit operating systems!

Share:
7,664

Related videos on Youtube

Manimaran
Author by

Manimaran

Updated on September 18, 2022

Comments

  • Manimaran
    Manimaran over 1 year

    When a user launches a 32 bit .Net application in a 64 bit environment, in the task manager it displays with a different name.

    For example if my application name is Shipnet.Shell.exe, in the task manager it displays SH7910~1.exe*32. Due to this name change the TASKKILL command execution fails.

    How can I get the correct name to use with TASKKILL?

    Some background:

    We are having a legacy product developed in Centura Team Developer 4.2 (Gupta Sql Windows). From our legacy product we can invoke 32 bit .Net applications. My product is very huge and having hundreds of applications developed in Centura and .Net. User can launch multiple application from main menu (Centura and .Net). There is a Logout menu in main menu screen. When user click this menu our product close all Centura and .Net application. Centura takes care of it's own application in the closing process. We are using TASKKILL command to close all .Net applications launched from our product. This is working fine with Windows 32 bit environment. When we deploy the same in Windows 64 bit environment our product is not able to close the .Net applications. The reason is TASKKILL command not able to get the correct name of the application.

    • Ramhound
      Ramhound almost 11 years
      The simple solution would be to compile a 32-bit and a 64-bit version of your application.
  • Gizmo
    Gizmo almost 11 years
    and the commands I provided don't work?