Find process using process id windows

Finding the process ID

Each process running in Windows is assigned a unique decimal number called the process ID (PID). This number is used in a number of ways, for example to specify the process when attaching a debugger to it.

This topic describes how you can determine the PID for a given app using Task Manager, the tasklist Windows command, the TList utility, or the debugger.

Task Manager

Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager.

In Windows 10, first click More details to expand the information displayed. From the Processes tab, select the Details tab to see the process ID listed in the PID column.

Click on any column name to sort. You can right click a process name to see more options for a process.

Some kernel errors may cause delays in Task Manager’s graphical interface.

The tasklist command

Use the built in Windows tasklist command from a command prompt to display all processes, their PIDs, and a variety of other details.

Use tasklist /? to display command line help.

TList utility

Task List Viewer (TList), or tlist.exe, is a command-line utility that displays the list of tasks, or user-mode processes, currently running on the local computer. TList is included in the Debugging Tools for Windows. For information on how to download and install the debugging tools, see Download Debugging Tools for Windows.

If you installed the Windows Driver Kit in the default directory on a 64 bit PC, the debugging tools are located here:

C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\

When you run TList from the command prompt, it will display a list of all the user-mode processes in memory with a unique PID number. For each process, it shows the PID, process name, and, if the process has a window, the title of that window.

For more information, see TList.

The .tlist debugger command

If there’s already a user-mode debugger running on the system in question, the .tlist (List Process IDs) command will display a list of all PIDs on that system.

PowerShell Get-Process command

To work with automation scripts, use the Get-Process PowerShell command. Specify a specific process name, to see the process ID for that process.

For more information, see Get-Process.

CSRSS and user-mode drivers

To debug a user-mode driver running on another computer, debug the Client Server Run-Time Subsystem (CSRSS) process. For more information, see Debugging CSRSS.

Find the PID of a process that uses a port on Windows

My service crash on startup with the classic:

Читайте также:  Что такое dash для линукс

How can I find the process for killing it?

7 Answers 7

Just open a command shell and type (saying your port is 123456):

You will see everything you need.

The headers are:

Find the PID of a process that uses a port on Windows (e.g. port: «9999»)

-a Displays all connections and listening ports.

-o Displays the owning process ID associated with each connection.

-n Displays addresses and port numbers in numerical form.

Then kill the process by PID

/F — Specifies to forcefully terminate the process(es).

Note: You may need an extra permission (run from administrator) to kill some certain processes

Command:

Output:

Now cut the process ID, «10396», using the for command in Windows.

Command:

Output:

If you want to cut the 4th number of the value means «LISTENING» then command in Windows.

Command:

Output:

If you want to do this programmatically you can use some of the options given to you as follows in a PowerShell script:

However; be aware that the more accurate you can be the more precise your PID result will be. If you know which host the port is supposed to be on you can narrow it down a lot. netstat -aon | findstr «0.0.0.0:9999» will only return one application and most llikely the correct one. Only searching on the port number may cause you to return processes that only happens to have 9999 in it, like this:

The most likely candidate usually ends up first, but if the process has ended before you run your script you may end up with PID 12331 instead and killing the wrong process.

How to find the process id of a running Java process on Windows? And how to kill the process alone?

I want to kill the particular Java process in Windows, like in Linux ( ps -aux to get processid and then kill processid to kill the process).

8 Answers 8

You can use the jps utility that is included in the JDK to find the process id of a Java process. The output will show you the name of the executable JAR file or the name of the main class.

Then use the Windows task manager to terminate the process. If you want to do it on the command line, use

You can also find the PID of a java program with the task manager. You enable the PID and Command Line columns View -> Select Columns and are then able to find the right process.

Your result will be something like this :

After setting the path of your jdk use JPS .Then You can eaisly kill it by Task Manager
JPS will give you all java processes

This will work even when there are multiple instance of jar is running

The solution I found is very simple. Use Window’s WMIC & Java’s Runtime to locate & kill the process.

Читайте также:  Java plug in windows

Part 1: You need to put some sort of identifier into your app’s startup command line. E.g. something like:

Part 2: When you run your app, make sure to include the string. Let’s say you start it from within Java, do the following:

Part 3: To kill the process, use Window’s WMIC. Just make sure you app was started containing your id from above:

In windows XP and later, there’s a command: tasklist that lists all process id’s.

For killing a process in Windows, see:

You can execute OS-commands in Java by:

If you need to handle the output of a command, see example: using Runtime.exec() in Java

This is specific to Windows. I was facing the same issue where I have to kill one specific java program using taskkill. When I run the java program, tasklist was showing the same program with Image name set as java.exe. But killing it using taskkill /F java.exe will stop all other java applications other than intended one which is not required.

So I run the same java program using:

Here start command will open a new window and run the java program with window’s title set to MyProgramName.

Now to kill this java-program use the following taskkill command:

Your Java program will be killed only. Rest will be unaffected.

Finding the process that a window belongs to

Last edited on Sep 23, 2020

On Unix¶

It is possible to discover which process a window belongs to by using the xprop command line tool (which is part of the Debian package x11-utils ).

Execute the following command in a shell:

Click on the window whose process should be identified. (If the desired window is not visible, use Alt+Tab to bring it to the foreground.) The above command should then output the process ID, for example:

To output the parent process ID (PPID), process ID (PID) and the complete command used for executing a process, the following command can be used (in the same way):

On Windows¶

It is possible to discover which process a window belongs to by using the Process Explorer tool.

Start Process Explorer:

Drag and drop the “Find Windows’s Process” symbol onto the window whose process should be identified:

After the drop, Process Explorer selects the process that the window belongs to:

Double click (or right click and choose Properties from context menu) the respective process to show its more of its details:

  • windows
  • linux
  • mac
  • diagnostic

Copyright В© 2021 froglogic GmbH. All rights reserved. Privacy Policy

Usage Data Processing by Google

We would like to use Google Analytics to get a better understanding of how you use the website.

By agreeing to this, your usage data will be stored in the USA and processed by Google LLC. Both Google as well as federal US agencies can access this data and combine it with any other data about you, such as your search history, personal accounts or any other data known to Google.

Читайте также:  Горячие клавиши для завершения работы windows 10

See our privacy policy to toggle this feature and to learn more, or contact us.

Process. Id Свойство

Определение

Получает уникальный идентификатор связанного процесса. Gets the unique identifier for the associated process.

Значение свойства

Созданный системой уникальный идентификатор, на который ссылается этот экземпляр Process. The system-generated unique identifier of the process that is referenced by this Process instance.

Исключения

Свойство Id процесса не задано. The process’s Id property has not been set.

-или- -or- С этим объектом Process не связаны никакие процессы. There is no process associated with this Process object.

Примеры

В следующем примере показано, как получить объект Id для всех работающих экземпляров приложения. The following example demonstrates how to obtain the Id for all running instances of an application. Код создает новый экземпляр блокнота, перечисляет все экземпляры Блокнота, а затем позволяет пользователю ввести Id номер, чтобы удалить конкретный экземпляр. The code creates a new instance of Notepad, lists all the instances of Notepad, and then allows the user to enter the Id number to remove a specific instance.

Комментарии

Этот процесс Id недействителен, если связанный процесс не выполняется. The process Id is not valid if the associated process is not running. Поэтому перед попыткой получить свойство необходимо убедиться в том, что процесс выполняется Id . Therefore, you should ensure that the process is running before attempting to retrieve the Id property. До завершения процесса идентификатор процесса однозначно определяет процесс во всей системе. Until the process terminates, the process identifier uniquely identifies the process throughout the system.

Процесс, работающий на локальном или удаленном компьютере, можно подключить к новому Process экземпляру, передав идентификатор процесса в GetProcessById метод. You can connect a process that is running on a local or remote computer to a new Process instance by passing the process identifier to the GetProcessById method. GetProcessById — Это static метод, который создает новый компонент и устанавливает Id свойство для нового Process экземпляра автоматически. GetProcessById is a static method that creates a new component and sets the Id property for the new Process instance automatically.

Идентификаторы процессов могут повторно использоваться системой. Process identifiers can be reused by the system. IdЗначение свойства является уникальным только во время выполнения связанного процесса. The Id property value is unique only while the associated process is running. После завершения процесса система может повторно использовать Id значение свойства для несвязанного процесса. After the process has terminated, the system can reuse the Id property value for an unrelated process.

Поскольку идентификатор уникален в системе, его можно передать другим потокам в качестве альтернативы передаче Process экземпляра. Because the identifier is unique on the system, you can pass it to other threads as an alternative to passing a Process instance. Это действие может сэкономить системные ресурсы, тем самым гарантируя правильную идентификацию процесса. This action can save system resources yet guarantee that the process is correctly identified.

Оцените статью