最新消息:20210917 已从crifan.com换到crifan.org

【已解决】windows中类似于ps查看进程的命令

Windows crifan 2537浏览 0评论
windows ps 进程
windows 命令 ps 进程
自己在vscode的PowerShell中可以用ps
ps | findstr  mitmdump
     48       4      736       2600          1   9924   1 mitmdump
    613      85    65436      74588        264  21168   1 mitmdump
但是cmd中不支持
D:\dev\DevRoot\mitmdumpUrlSaver\pyinstaller>ps | findstr mitmdump
'ps' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
windows cmd 类似ps
windows 中有没有 类似 Linux 中的命令 [code] ps -ef|awk ‘{print $1}'[/code] – Linux新手园地-Chinaunix
tasklist
如何获取Windows命令行参数信息(和Linux中的ps -ef的输出相似)_花果山-CSDN博客

D:\dev\DevRoot\mitmdumpUrlSaver\pyinstaller>tasklist /?


TASKLIST [/S system [/U username [/P [password]]]]
         [/M [module] | /SVC | /V] [/FI filter] [/FO format] [/NH]


描述:
    该工具显示在本地或远程机器上当前运行的进程列表。


参数列表:
   /S     system           指定连接到的远程系统。


   /U     [domain\]user    指定应该在哪个用户上下文执行这个命令。


   /P     [password]       为提供的用户上下文指定密码。如果省略,则
                           提示输入。


   /M     [module]         列出当前使用所给 exe/dll 名称的所有任务。
                           如果没有指定模块名称,显示所有加载的模块。


   /SVC                    显示每个进程中主持的服务。


   /APPS 显示 Microsoft Store 应用及其关联的进程。


   /V                      显示详细任务信息。


   /FI    filter           显示一系列符合筛选器
                           指定条件的任务。


   /FO    format           指定输出格式。
                           有效值: "TABLE"、"LIST"、"CSV"。


   /NH                     指定列标题不应该
                           在输出中显示。
                           只对 "TABLE" 和 "CSV" 格式有效。


   /?                      显示此帮助消息。


筛选器:
    筛选器名称     有效运算符           有效值
    -----------     ---------------           --------------------------
    STATUS          eq, ne                    RUNNING | SUSPENDED
                                              NOT RESPONDING | UNKNOWN
    IMAGENAME       eq, ne                    映像名称
    PID             eq, ne, gt, lt, ge, le    PID 值
    SESSION         eq, ne, gt, lt, ge, le    会话编号
    SESSIONNAME     eq, ne                    会话名称
    CPUTIME         eq, ne, gt, lt, ge, le    CPU 时间,格式为
                                              hh:mm:ss。
                                              hh - 小时,
                                              mm - 分钟,ss - 秒
    MEMUSAGE        eq, ne, gt, lt, ge, le    内存使用(以 KB 为单位)
    USERNAME        eq, ne                    用户名,格式为
                                              [域\]用户
    SERVICES        eq, ne                    服务名称
    WINDOWTITLE     eq, ne                    窗口标题
    模块         eq, ne                    DLL 名称


注意: 当查询远程计算机时,不支持 "WINDOWTITLE" 和 "STATUS"
      筛选器。


Examples:
    TASKLIST
    TASKLIST /M
    TASKLIST /V /FO CSV
    TASKLIST /SVC /FO LIST
    TASKLIST /APPS /FI "STATUS eq RUNNING"
    TASKLIST /M wbem*
    TASKLIST /S system /FO LIST
    TASKLIST /S system /U 域\用户名 /FO CSV /NH
    TASKLIST /S system /U username /P password /FO TABLE /NH
    TASKLIST /FI "USERNAME ne NT AUTHORITY\SYSTEM" /FI "STATUS eq running"
去试试
D:\dev\DevRoot\mitmdumpUrlSaver\pyinstaller>tasklist | findstr mitmdump
是没有输出,是对的。
然后vscode的PowerShell中允许mitmproxy,再去测试
r>tasklist | findstr mitmdump
mitmdump.exe                 16544 Console                    1      2,660 K
mitmdump.exe                 25044 Console                    1     64,900 K
就可以有输出了。

windows tasklist
windows 显示进程的命令 TASKLIST 详解 – suoliw – 博客园
https://www.cnblogs.com/suoliw/articles/2228705.html
本机的显示结果由五部分组成:图像名(进程名)、PID、会话名、会话#、内存使用
tasklist /s 218.22.123.26 /u jtdd /p 12345678

tasklist /svc

tasklist /m shell32.dll
windows 上 tasklist 命令的使用-百度经验
【总结】
windows中,类似Linux中ps,查看进程信息的命令是:tasklist
具体用法,可参考:
tasklist /?
输出的帮助信息
举例:
(1)普通的tasklist
Microsoft Windows [版本 10.0.17763.914]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\xxx>tasklist

映像名称                       PID 会话名              会话#       内存使用
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0          8 K
System                           4 Services                   0        124 K
Registry                       120 Services                   0     79,260 K
smss.exe                       416 Services                   0      1,004 K
csrss.exe                      700 Services                   0      4,328 K
wininit.exe                    796 Services                   0      4,588 K
csrss.exe                      804 Console                    1      5,360 K
services.exe                   872 Services                   0     11,508 K
winlogon.exe                   904 Console                    1      7,880 K
lsass.exe                      956 Services                   0     18,300 K
svchost.exe                    444 Services                   0      3,108 K
....
注:此处默认是table,所以此处
tasklist
等价于:
tasklist /fo table
(2)分页显示
补充:如果输出内容太多,想要分页显示,可以借助more:
tasklist |more
(3)指定输出格式
C:\Users\xxx>tasklist /fo list

映像名称:     System Idle Process
PID:          0
会话名      : Services
会话#   :     0
内存使用 :    8 K


映像名称:     System
PID:          4
会话名      : Services
会话#   :     0
内存使用 :    124 K


映像名称:     Registry
PID:          120
会话名      : Services
会话#   :     0
内存使用 :    77,616 K


映像名称:     smss.exe
PID:          416
会话名      : Services
会话#   :     0
内存使用 :    980 K
...
(4)查看服务
C:\Users\xxx>tasklist /svc

映像名称                       PID 服务
========================= ======== ============================================
System Idle Process              0 暂缺
System                           4 暂缺
Registry                       120 暂缺
smss.exe                       416 暂缺
csrss.exe                      700 暂缺
wininit.exe                    796 暂缺
csrss.exe                      804 暂缺
services.exe                   872 暂缺
winlogon.exe                   904 暂缺
lsass.exe                      956 KeyIso, Netlogon, SamSs, VaultSvc
svchost.exe                    444 PlugPlay
svchost.exe                    456 BrokerInfrastructure, DcomLaunch, Power,
                                   SystemEventsBroker
WUDFHost.exe                   632 暂缺
fontdrvhost.exe                636 暂缺
fontdrvhost.exe                656 暂缺
svchost.exe                   1060 RpcEptMapper, RpcSs
svchost.exe                   1104 LSM
dwm.exe                       1200 暂缺
svchost.exe                   1276 W32Time
svchost.exe                   1288 nsi
svchost.exe                   1304 bthserv
svchost.exe                   1316 BthAvctpSvc
svchost.exe                   1404 Dnscache
svchost.exe                   1424 NcbService
svchost.exe                   1432 TimeBrokerSvc
svchost.exe                   1500 Dhcp
svchost.exe                   1556 CoreMessagingRegistrar
svchost.exe                   1672 EventSystem
svchost.exe                   1692 hidserv
svchost.exe                   1744 BFE, mpssvc
svchost.exe                   1812 BTAGService
svchost.exe                   1836 EventLog
svchost.exe                   1896 SENS
svchost.exe                   1972 DeviceAssociationService
igfxCUIService.exe            2012 igfxCUIService2.0.0.0
...

转载请注明:在路上 » 【已解决】windows中类似于ps查看进程的命令

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
99 queries in 0.182 seconds, using 23.44MB memory