为什么我不断收到错误“命令的语法不正确”

发布于 2024-09-19 11:01:28 字数 944 浏览 7 评论 0原文

有人可以向我解释为什么这个命令报告“命令的语法不正确。”?第一部分本身运行良好,所以我知道事实并非如此。根据 help find 第二部分看起来是正确的,

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type error.log ^| find /C "2010"

我想知道它是否可能与文件中的行结尾有关,但即使像这样简单的事情也会给我带来同样的错误:

C:\Program Files\Apache Software Foundation\Apache2.2\logs>echo "Test1" > test.log

C:\Program Files\Apache Software Foundation\Apache2.2\logs>echo "Test2" >> test.log

C:\Program Files\Apache Software Foundation\Apache2.2\logs>echo "Test3" >> test.log

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type test.log
"Test1"
"Test2"
"Test3"

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type test.log ^| find /C "test"
The syntax of the command is incorrect.

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type test.log ^| find /C "Test"
The syntax of the command is incorrect.

Can someone explain to me why this command reports "The syntax of the command is incorrect."? The first part runs fine by itself, so I know it's not that. And the second part looks to be correct according to help find

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type error.log ^| find /C "2010"

I was wondering if it might have to do with line endings in the file, but even something as simple as this gives me the same error:

C:\Program Files\Apache Software Foundation\Apache2.2\logs>echo "Test1" > test.log

C:\Program Files\Apache Software Foundation\Apache2.2\logs>echo "Test2" >> test.log

C:\Program Files\Apache Software Foundation\Apache2.2\logs>echo "Test3" >> test.log

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type test.log
"Test1"
"Test2"
"Test3"

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type test.log ^| find /C "test"
The syntax of the command is incorrect.

C:\Program Files\Apache Software Foundation\Apache2.2\logs>type test.log ^| find /C "Test"
The syntax of the command is incorrect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生死何惧 2024-09-26 11:01:28

您需要向 find 命令提供文件名:

find /C "test" test.log

键入 test.log |找到/C“测试”

You need to supply the filename to the find command:

find /C "test" test.log

or

type test.log | find /C "test"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文