使用WQL获取正在运行的Windows可执行文件的文件大小

时间:2016-04-29 06:10:21

标签: windows powershell wql

有没有办法使用WQL查询计算Windows进程可执行文件的文件大小?

我尝试了下面的内容,但Powershell给了我一个管理例外。

SELECT Caption, ExecutablePath, CommandLine From Win32_Process, (SELECT FileSize FROM Cim_DataFile WHERE Win32_Process.ExecutablePath = Cim_DataFile.Name) as ExecutableSize WHERE ExecutablePath != ''

Powershell的输出

  

Get-WmiObject:无效查询在行:1 char:14   + Get-WmiObject<<<< -Query" SELECT Caption,ExecutablePath,CommandLine来自Win32_Process,(SELECT FileSize FROM Cim   _DataFile WHERE Win32_Process.ExecutablePath = Cim_DataFile.Name)as ExecutableSize WHERE ExecutablePath!=''"       + CategoryInfo:InvalidOperation:(:) [Get-WmiObject],ManagementException       + FullyQualifiedErrorId:GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

有人可以建议吗?

0 个答案:

没有答案