从cmd/PS终端,我们如何显示与启动服务相关的EXE?

从cmd/PS终端,我们如何显示与启动服务相关的EXE?
PS C:\Users\ally> net start
These Windows services are started:

   Application Information
   Background Intelligent Transfer Service
   Background Tasks Infrastructure Service
   Base Filtering Engine
   Client License Service (ClipSVC)
   Clipboard User Service_31fc7
   CNG Key Isolation
   COM+ Event System
   Computer Browser
   Connected Devices Platform Service
   Connected Devices Platform User Service_31fc7
   Connected User Experiences and Telemetry
   CoreMessaging
   Credential Manager
   Cryptographic Services
   Data Usage
   DCOM Server Process Launcher
   Device Setup Manager
   DHCP Client
   Diagnostic Policy Service
   Diagnostic Service Host
   Display Policy Service
   Distributed Link Tracking Client
   DNS Client
   Group Policy Client
   IP Helper
   Local Session Manager
   Microsoft Account Sign-in Assistant
   Microsoft Passport Container
   Network Connection Broker
   Network List Service
   Network Location Awareness
   Network Store Interface Service
   Payments and NFC/SE Manager
   Plug and Play
   Power
   Print Spooler
   Remote Access Connection Manager
   Remote Procedure Call (RPC)
   RPC Endpoint Mapper
   Secure Socket Tunneling Protocol Service
   Security Accounts Manager
   Security Center
   Server
   Shell Hardware Detection
   SSDP Discovery
   State Repository Service
   Storage Service
   Sync Host_31fc7
   SysMain
   System Event Notification Service
   System Events Broker
   System Guard Runtime Monitor Broker
   Task Scheduler
   TCP/IP NetBIOS Helper
   Themes
   Time Broker
   Touch Keyboard and Handwriting Panel Service
   Update Orchestrator Service
   User Manager
   User Profile Service
   WarpJITSvc
   Web Account Manager
   Windows Audio
   Windows Audio Endpoint Builder
   Windows Biometric Service
   Windows Connection Manager
   Windows Defender Antivirus Network Inspection Service
   Windows Defender Antivirus Service
   Windows Defender Firewall
   Windows Event Log
   Windows Font Cache Service
   Windows License Manager Service
   Windows Management Instrumentation
   Windows Modules Installer
   Windows Push Notifications System Service
   Windows Push Notifications User Service_31fc7
   Windows Search
   Windows Security Service
   Windows Update
   WinHTTP Web Proxy Auto-Discovery Service
   Workstation

The command completed successfully.

答案1

扩展@iskyfire 的有用答案:

tasklist /svc /fo csv | Select-String -Notmatch "N/A" | Set-Content work.csv
(Import-Csv work.csv | Select-Object -ExpandProperty Services) -join "," -split "," | Foreach {
  [PSCustomObject]@{
    'Service name' = $_
    'Display name' = (Get-Service $_ -ErrorAction SilentlyContinue | Select-Object -ExpandProperty DisplayName)
    'Application name' = ((tasklist /svc | select-string "$_") -split "\s+")[0]
  }
} | Out-GridView -Title "Services"
Remove-Item work.csv

这是一个 powershell 脚本,它将在 GridView 中显示所有正在运行的服务、它们的显示名称和应用程序名称。Out-GridView如果您愿意,可以省略。

答案2

值得注意的是,许多此类服务的可执行文件是svchost.exe。许多第三方应用程序会使用自己的可执行文件来执行服务。例如,AMD External Events Utility 是atiesrxx.exe

您可以通过运行以下命令找出当前正在运行的服务所关联的应用程序:

tasklist /svc

相关内容