powershell - 在 cmd 和 INFO : Could not find files for the given pattern(s) 下执行 powershell 命令

标签 powershell cmd

我正在尝试从 CMD 执行以下 powershell 命令,例如:

powershell Get-WmiObject Win32_PnPSignedDriver 

powershell Get-WmiObject Win32_PnPSignedDriver > test.txt 

两者都可以正常工作。

但是当我进行查询时,例如:

powershell (Get-WmiObject Win32_PnPSignedDriver | where {$_.location -like "*PCI bus 0, device 22, function 0*"}).DeviceName

我收到此消息,我无法确定其原因:

INFO: Could not find files for the given pattern(s)

最佳答案

这似乎对我有用(我看到的错误与您最初看到的错误相同):

powershell -command "(Get-WmiObject Win32_PnPSignedDriver | where {$_.location -like '*PCI bus 0, device 22, function 0*'}).DeviceName"

关于powershell - 在 cmd 和 INFO : Could not find files for the given pattern(s) 下执行 powershell 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43494895/

相关文章:

linux - Dns 不包含 `GetHostEntry' 的定义

powershell - Azure PowerShell - 如何创建队列(如果不存在)

powershell - 从Windows CMD将数组传递到PowerShell

powershell - Powershell:如何轻松在 'Out-String'和 'Get-Content'字符串变量类型之间切换?

linux - 如何从 "DIR"结果 : "File name is too long" from printing in console 中删除此错误

windows - 如何在批处理文件中更改为当前用户的目录

powershell - 如何选择名称中包含括号的 NoteProperty

batch-file - CMD.EXE批处理脚本显示txt文件中的最后10行

windows - 以编程方式更改 CMD 窗口属性

java - 如何跳过使用 taskkill 杀死进程