【发布时间】:2017-11-20 09:05:57
【问题描述】:
我正在使用以下代码从file1.txt 中删除file2.txt 中的行。
powershell -Command "$(Get-Content file1.txt) | Where-Object {$_ -notIn $(Get-Content file2.txt)}"
但是我收到一个关于 -notIn 的错误,正在寻找一个值表达式。但file2.txt 确实存在且不为空。
是什么导致了错误,如何解决?
【问题讨论】:
-
PowerShell 版本?
-
@PetSerAl 版本 2
-
-in和-notin是 v3+ -
@PetSerAl 谢谢。如果可能的话,我需要让它与默认安装的 Windows 7 Pro 兼容。
标签: windows file windows-7 powershell-2.0