在 findstr 中转义引号

escaping quotes in findstr

需要对以下 findstr 命令进行哪些更改才能 return 在包含在目录和子目录?

findstr /I "port" : " *  

显然,转义引号是必要的,但是需要什么特定语法来转义引号,同时仍然使表达式达到 return 预期值?

这是在 windows 8.1 上使用 cmd.exe

您需要转义双引号,并且由于您的正则表达式使用 spaces,请使用 /c 开关传递搜索字符串而不是 space 分隔的正则表达式:

findstr /I /c:"port\" : " *

来自 here:

multiple Regular Expressions can be separated with spaces, just the same as separating multiple words (assuming you have not specified a literal search with /C) but this might not be useful if the regex itself contains spaces.