【发布时间】:2019-05-29 11:53:05
【问题描述】:
$DeviceID 的值为:"PCI\VEN_8086&DEV_9D3A&SUBSYS_225617AA&REV_21\3&11583659&1&B0"
我正在尝试使用“Select-String”在 .INF 文件中搜索该字符串:
Select-String -Path C:\file.inf -Pattern "$DeviceID"
但它不会按原样获取字符串,它的“\V”有问题:
选择字符串:链式 PCI\VEN_8086&DEV_9D3A&SUBSYS_225617AA&REV_21\ 3&11583659&1&B0 n'est pas une expression régulière valide: analyze de “PCI\VEN_8086&DEV_9D3A&SUBSYS_225617AA&REV_21\3&11583659&1&B0” - 序列 d'échappement \V non reconnue。 Au caractère Ligne:15 : 5 + Select-String -Path $($_.FullName) -pattern "$($erreur.DeviceID)" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument : (:) [Select-String], ArgumentException + FullyQualifiedErrorId : InvalidRegex,Microsoft.PowerShell.Commands.SelectStringCommand对不起法语,但它基本上说“字符串不是有效的正则表达式。转义序列 \V 无法识别”。
【问题讨论】: