如何在 Windows 中的 powershell 中使用 ack 在文件中搜索“<”?

Tom*_*Tom 3 windows powershell escaping ack

我不知道如何转义“<”字符,而且我对“系统找不到指定的文件”错误感到困惑。任何人都可以帮忙吗?

我在 Windows XP 的 powershell 中使用 ack。

问题ack-grep: chars escaping与我的非常相似,但是为该问题提供和接受的解决方案对我不起作用。

PS C:\xampp\htdocs> ack abcd
<works as expected>
PS C:\xampp\htdocs> ack <
The redirection operator '<' is not supported yet.
At line:1 char:5
+ ack < <<<<
PS C:\xampp\htdocs> ack \<
The syntax of the command is incorrect.
PS C:\xampp\htdocs> ack '<'
The syntax of the command is incorrect.
PS C:\xampp\htdocs> ack '\<'
The syntax of the command is incorrect.
PS C:\xampp\htdocs> ack [<]
The system cannot find the file specified.
PS C:\xampp\htdocs> ack '[<]'
The system cannot find the file specified.
PS C:\xampp\htdocs> ack '[\<]'
The system cannot find the file specified.
PS C:\xampp\htdocs> ack \Q<\E
The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

Jas*_*her 5

您是否有任何理由不想使用 PowerShell 的正则表达式搜索?

Select-String '<' *.*

## or
dir -r | Select-String '<'
Run Code Online (Sandbox Code Playgroud)