- tasklist tasklist
- Синтаксис Syntax
- Параметры Parameters
- Имена фильтров, операторы и значения Filter names, operators, and values
- Примеры Examples
- Get already running windows process’ console output in a command prompt? Direct StreamReader to command prompt
- 1 Answer 1
- How to Open Command Prompt
- Open Command Prompt to Execute Commands in Windows 10, 8, 7, Vista, & XP
- Open Command Prompt in Windows 10
- Open Command Prompt Through the Start Menu
- Open Command Prompt Using Power User Menu
- Open Command Prompt in Windows 8 or 8.1
- Open Command Prompt in Windows 7, Vista, or XP
- Other Ways to Open Command Prompt
- Elevated Command Prompts and Old Windows Versions
tasklist tasklist
Отображает список запущенных в данный момент процессов на локальном или удаленном компьютере. Displays a list of currently running processes on the local computer or on a remote computer. Tasklist заменяет средство TList . Tasklist replaces the tlist tool.
Эта команда заменяет средство TList . This command replaces the tlist tool.
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
ключ /s | Указывает имя или IP-адрес удаленного компьютера (не используйте символы обратной косой черты). Specifies the name or IP address of a remote computer (do not use backslashes). По умолчанию это локальный компьютер. The default is the local computer. |
/u \ /u \ | Выполняет команду с разрешениями учетной записи пользователя, заданного или пользователем \ . Runs the command with the account permissions of the user who is specified by or by \ . Параметр /u может быть указан только в том случае, если задано также значение /s . The /u parameter can be specified only if /s is also specified. По умолчанию заданы разрешения пользователя, который в данный момент вошел в систему компьютера, выполняющего команду. The default is the permissions of the user who is currently logged on to the computer that is issuing the command. |
/p |
Указывает формат, используемый для выходных данных. Specifies the format to use for the output. Допустимые значения: Table, List и CSV. Valid values are table, list, and csv. Формат выходных данных по умолчанию — Table. The default format for output is table. | |
использован /nh | Подавляет вывод заголовков столбцов в выходных данных. Suppresses column headers in the output. Допустим, если для параметра /FO задано значение Table или CSV. Valid when the /fo parameter is set to table or csv. |
/Fi /fi | Указывает типы процессов, включаемых в запрос или исключаемых из него. Specifies the types of processes to include in or exclude from the query. Можно использовать более одного фильтра или использовать подстановочный знак ( \ ) для указания всех задач или имен изображений. You can use more than one filter or use the wildcard character ( \ ) to specify all tasks or image names. Допустимые фильтры перечислены в разделе имена фильтров, операторы и значения этой статьи. The valid filters are listed in the Filter names, operators, and values section of this article. |
/? /? | Отображение справки в командной строке. Displays help at the command prompt. |
Имена фильтров, операторы и значения Filter names, operators, and values
Имя фильтра Filter Name | Допустимые операторы Valid Operators | Допустимые значения Valid Value(s) |
---|---|---|
Состояние STATUS | eq, ne eq, ne | RUNNING | NOT RESPONDING | UNKNOWN . RUNNING | NOT RESPONDING | UNKNOWN . Этот фильтр не поддерживается, если указана удаленная система. This filter isn’t supported if you specify a remote system. |
IMAGENAME IMAGENAME | eq, ne eq, ne | Имя образа Image name |
ИД процесса PID | eq, ne, gt, lt, ge, le eq, ne, gt, lt, ge, le | Значение PID PID value |
SESSION SESSION | eq, ne, gt, lt, ge, le eq, ne, gt, lt, ge, le | Номер сеанса Session number |
SESSIONNAME SESSIONNAME | eq, ne eq, ne | Имя сеанса Session name |
CPUtime CPUtime | eq, ne, gt, lt, ge, le eq, ne, gt, lt, ge, le | Время ЦП в формате чч: мм: СС, где mm и SS находятся в диапазоне от 0 до 59, а чч — любое число без знака CPU time in the format HH:MM:SS, where MM and SS are between 0 and 59 and HH is any unsigned number |
мемусаже MEMUSAGE | eq, ne, gt, lt, ge, le eq, ne, gt, lt, ge, le | Использование памяти в КБ Memory usage in KB |
USERNAME USERNAME | eq, ne eq, ne | Любое допустимое имя пользователя ( или ) Any valid user name ( or ) |
Обслуживание SERVICES | eq, ne eq, ne | Имя службы Service name |
WINDOWTITLE WINDOWTITLE | eq, ne eq, ne | Заголовок окна. Window title. Этот фильтр не поддерживается, если указана удаленная система. This filter isn’t supported if you specify a remote system. |
МОДУЛЕ MODULES | eq, ne eq, ne | Имя DLL DLL name |
Примеры Examples
Чтобы получить список всех задач с идентификатором процесса, превышающим 1000, и отобразить их в формате CSV, введите: To list all tasks with a process ID greater than 1000, and display them in csv format, type:
Чтобы получить список системных процессов, выполняемых в данный момент, введите: To list the system processes that are currently running, type:
Чтобы вывести подробные сведения обо всех выполняющихся процессах, введите: To list detailed information for all processes that are currently running, type:
Чтобы получить список всех сведений о службе для процессов на удаленном компьютере срвмаин с именем DLL, начинающимся с NTDLL, введите: To list all the service information for processes on the remote computer srvmain, which has a DLL name beginning with ntdll, type:
Чтобы получить список процессов на удаленном компьютере срвмаин, используя учетные данные текущей учетной записи пользователя, выполнившего вход в систему, введите: To list the processes on the remote computer srvmain, using the credentials of your currently logged-on user account, type:
Чтобы получить список процессов на удаленном компьютере срвмаин, используя учетные данные хироплн учетной записи пользователя, введите: To list the processes on the remote computer srvmain, using the credentials of the user account Hiropln, type:
Get already running windows process’ console output in a command prompt? Direct StreamReader to command prompt
I am trying to determine if there is a way to get the console output, in a command prompt, of an already running process in the windows environment via C#. I have seen an answer for linux based systems through the shell and also a way to retrieve a Process object. Though neither offer a solution to get the output of the process.
I my code I currently find a process (MongodDB daemon) this way
I have also found the Process.StandardOutput property which supplies «A StreamReader that can be used to read the standard output stream of the application.». Is there a way to direct this StreamReader input to a command prompt output?
I also know that I can start a process and display the command prompt (process output), but this is only when the process is started «by me».
I also know that I could simply read from the StreamReader and display the output in my own way, but I would really prefer to just display a command prompt.
1 Answer 1
Windows does not provide any mechanism to retroactively give another process a standard output handle if it was created without one. (Besides, in most cases an application will check the standard output handle only during startup.)
If you know (or can successfully guess) how a specific application generates output, it may in principle be possible to start capturing that output by injecting your own code into the process. For example, if you know that the application uses C++ and is dynamically linked to the VS2015 runtime library, you might inject code that calls freopen as shown here. (In this scenario, you must know which runtime library the application uses because you have specify it when looking up the address for freopen .)
However, code injection is not trivial, and creates a risk of inadvertently causing the process to malfunction. Also, any output that has already been generated will almost certainly have been discarded and be irrevocably lost.
How to Open Command Prompt
Open Command Prompt to Execute Commands in Windows 10, 8, 7, Vista, & XP
Some popular Command Prompt commands you might have heard of include ping, netstat, tracert, shutdown, and attrib, but there are many more. We have a complete list here.
While Command Prompt probably isn’t a tool most of you will use on a regular basis, it can really come in handy now and then, maybe to troubleshoot a specific Windows problem or to automate some kind of task.
How you open Command Prompt differs between Windows versions, so you’ll find steps below for Windows 10, Windows 8 or Windows 8.1, and Windows 7, Windows Vista, and Windows XP. See What Version of Windows Do I Have? if you’re not sure.
Open Command Prompt in Windows 10
Select the Start button.
Type cmd.
Select Command Prompt from the list.
Open Command Prompt Through the Start Menu
Another way to open Command Prompt in Windows 10 is to look in its Start menu folder:
Select the Start button.
Select the Windows System folder from the list.
Choose Command Prompt from the folder group.
Open Command Prompt Using Power User Menu
One more method in Windows 10 is through the Power User Menu. If you’re using a keyboard or mouse, choose Command Prompt from the menu that appears after pressing Win+X or right-clicking the Start button.
You might see Windows PowerShell options in the Power User Menu instead of Command Prompt. In more recent versions of Windows 10, Command Prompt has been replaced by PowerShell, but you can still access it from the Power User Menu by editing the taskbar settings.
Open Command Prompt in Windows 8 or 8.1
Select the Start button and then swipe up to show the Apps screen. You can accomplish the same thing with a mouse by selecting the down arrow icon at the bottom of the screen.
Prior to the Windows 8.1 update, the Apps screen can be accessed from the Start screen by swiping up from the bottom of the screen, or right-clicking anywhere, and then choosing All apps.
If you’re using a keyboard or mouse, a really quick way to open a Command Prompt window in Windows 8 is through the Power User Menu—just hold the WIN and X keys down together, or right-click the Start button, and choose Command Prompt.
Swipe or scroll to the right on the Apps screen to locate the Windows System section heading.
Select Command Prompt. You can now execute whatever command you needed to run.
See our List of Windows 8 Command Prompt Commands for a complete list of the commands available through Command Prompt in Windows 8, including short descriptions and links to more in-depth information if we have it.
Open Command Prompt in Windows 7, Vista, or XP
Open the Start menu from the bottom-left corner of the screen.
In Windows 7 and Windows Vista, it’s a bit faster to enter command in the search box at the bottom of the Start menu and then choose Command Prompt when it appears in the results.
Go to All Programs > Accessories.
Choose Command Prompt from the list of programs.
Here’s our List of Windows 7 Commands and List of Windows XP Commands if you need a command reference for any of those versions of Windows.
Other Ways to Open Command Prompt
Command Prompt in Windows XP through Windows 10 can also be opened with a command. This is especially helpful if you like using the Run dialog box or if Windows Explorer has crashed and the Start menu is inaccessible (and thus the directions above don’t work).
To do this, enter cmd into the command-line interface. This can be in the Run dialog box (WIN+R) or Task Manager’s File > Run new task menu.
Elevated Command Prompts and Old Windows Versions
In versions of Windows released before Windows XP, like Windows 98 and Windows 95, Command Prompt doesn’t exist. However, the older and very similar MS-DOS Prompt does. This program is located in the Start menu and can be opened with the command run command.
Some commands, like the sfc command that’s used to repair Windows files, require that Command Prompt be opened as an administrator before they can be executed. You’ll know if this is the case if you get a message like one of these after trying to execute the command:
- check that you have administrative rights
- . command can only be executed from an elevated command prompt
- you must be an administrator
See How to Open an Elevated Command Prompt for help starting Command Prompt as an administrator, a process that’s a bit more complicated than what’s outlined above.