为什么我不断收到错误“命令的语法不正确”
有人可以向我解释为什么这个命令报告“命令的语法不正确。”?第一部分本身运行良好,所以我知道事实并非如此。根据 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要向 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"