- Как узнать PID (идентификатор процесса) в Windows
- Как узнать PID (идентификатор процесса) в диспетчере задач
- Как узнать PID (идентификатор процесса) в командной строке
- Finding the process ID
- Task Manager
- The tasklist command
- TList utility
- The .tlist debugger command
- PowerShell Get-Process command
- CSRSS and user-mode drivers
- Solved — How to Find Out the PID (Process ID) in Windows
- Get PID by Task Manager
- Get PID by Command Line
- PowerShell
- Find the PID of a process that uses a port on Windows
- 7 Answers 7
- Как получить PID собственного процесса из командной строки в Windows
Как узнать PID (идентификатор процесса) в Windows
В данной статье показаны действия, с помощью которых можно узнать PID (идентификатор процесса) в операционной системе Windows.
Идентификатор процесса (process identifier, PID) — уникальный номер процесса в операционной системе Windows.
Все процессы имеют уникальные идентификаторы PID, которые автоматически присваиваются каждому процессу когда он создается в операционной системе, что позволяет ядру системы различать процессы.
При необходимости можно узнать PID (идентификатор процесса).
Как узнать PID (идентификатор процесса) в диспетчере задач
Чтобы узнать PID (идентификатор процесса), откройте диспетчер задач и перейдите на вкладку Процессы, затем нажмите правой кнопкой мыши на заголовок таблицы и в контекстном меню выберите пункт ИД процесса .
Теперь найдите нужный процесс, и в столбце ИД процесса будет отображен идентификатор соответствующего процесса.
Как узнать PID (идентификатор процесса) в командной строке
Также узнать PID (идентификатор процесса) можно используя командную строку.
Запустите командную строку и выполните следующую команду:
Найдите нужный процесс, в столбце PID будет отображен идентификатор процесса.
Также можно отобразить процессы в виде списка, для этого в командной строке выполните следующую команду:
Найдите нужный процесс, в строке PID будет отображен идентификатор процесса.
Используя рассмотренные выше действия, можно узнать PID (идентификатор процесса) в операционной системе 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.
Solved — How to Find Out the PID (Process ID) in Windows
PID, the abbreviation of Process Identifier, is a unique number used to identify every running process or service in operating system like Windows, MacOS, and Linux. In this post, we will walk you through three methods of how to find out the PID (Process ID) in Windows.
Get PID by Task Manager
Whether in Windows 7 or Windows 10, you can both get the PID (Process ID) by Task Manager. Here are the detailed steps.
Step 1: Press Ctrl + Shift + Esc simultaneously to open Task Manager window.
Step 2: If the window shows in a simplified summary mode, click More details in the bottom left corner.
Step 3: On Task Manager window, click Details tab. Then the PID is shown on the screen. Finally, you can check the process id of every running process and deal with it as you want.
TIPS: If PID can’t be found on Task Manager in Windows, you can refer to the following steps to show PID on Task Manager. Firstly, on the Details tab, right-click the header of any column (like Name, Status) and then click Select columns. Then on the popup window, check the checkbox of PID and click OK to save the change. Finally, the PID will be shown on Task Manager.
Get PID by Command Line
It is also so convenient that you can check PID (Process ID) by command line within just two steps. Here is the guide.
Step 1: Press Windows Key + R to open a run window. Then type cmd and press Enter to open Command Prompt window.
Step 2: In Command Prompt window, type tasklist and press Enter. Then, the details of running processes or services including the PID are listed on the screen.
PowerShell
In the matter of getting process id, PowerShell offers the same feature as Command Prompt does and even the command line is the same. You just need to type PowerShell in Windows search box and press Enter to open PowerShell window. Then you can type tasklist and press Enter. Finally, the details of running processes including PID are listed as follows.
Find the PID of a process that uses a port on Windows
My service crash on startup with the classic:
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.
Как получить PID собственного процесса из командной строки в Windows
я пытаюсь найти способ получить свой собственный PID из командной строки (для последующего использования в скриптах bat), пока единственным полезным способом, который я нашел, было использование getpids.exe отсюда: http://www.scheibli.com/ projects / getpids / index.html, но я ищу команду, «встроенную» в windows
редактировать: я ищу способ «пуленепробиваемый» — никаких предположений о том, что мой процесс является единственным cmd.exe или что-то еще
Поскольку ни одно из других решений не является пуленепробиваемым и встроенным, я решил предложить следующее решение, но учтите, что вам нужно как-то проанализировать / сохранить результаты:
Я считаю, что следующее является пуленепробиваемым, при условии, что пользователь имеет доступ к WMIC и TEMP указывает на действительный путь, где у пользователя есть права на запись. Это конечный результат совместной работы на http://www.dostips.com/forum/viewtopic.php?f=3&t=6133 .
Сценарий устанавливает эксклюзивную блокировку для временного файла, который включает текущее время в имя. Столкновение может быть только в том случае, если два одинаковых пакетных процесса пытаются получить PID в течение одного и того же интервала времени 0,01 секунды, и в этом случае только один будет успешным.
Любой сбойный процесс будет многократно возвращаться назад и повторять попытку с новым путем к файлу блокировки, пока он не будет успешным.