此代码将起作用:
Get-NetAdapter | Where-Object {$_.InterfaceDescription -match 'Ethernet' -or $_.InterfaceDescription -match 'Wireless'}
我希望从TaskScheduler(Cmd)启动它,否则在PowerShell中此代码将无法工作:
Powershell.exe -Command "Get-NetAdapter | Where-Object {$_.InterfaceDescription -match 'Ethernet' -or $_.InterfaceDescription -match 'Wireless'}"
错误:
- ..EtAdapter|WHERE-Object{.InterfaceDescription-Match‘EtherNet’-或...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo:ObjectNotFound:(.InterfaceDescription:字符串)[Where-Object],CommandNotFoundException
- FullyQualifiedError ID:CommandNotFoundException,Microsoft.PowerShell.Commands.WhereObjectCommand
同样作为Base64字符串,也会出现相同的错误。
有没有人知道为什么在PS中它不是作为命令而是直接作为命令工作的?
1条答案
按热度按时间bxjv4tth1#