findstr不生成输出

时间:2016-12-22 23:37:20

标签: windows batch-file scripting

我有一个txt文件:

#deployment.properties
#Thu Dec 22 13:48:41 PST 2016
deployment.modified.timestamp=1482443321245
deployment.roaming.profile=false
deployment.version=8
deployment.browser.path=C\:\\Program Files\\Internet Explorer\\iexplore.exe
#Java Deployment jre's
#Thu Dec 22 13:48:41 PST 2016
deployment.javaws.jre.1.location=http\://java.sun.com/products/autodl/j2se
deployment.javaws.jre.0.args=
deployment.javaws.jre.0.registered=true
deployment.javaws.jre.1.args=
deployment.javaws.jre.1.enabled=false
deployment.javaws.jre.1.registered=true
deployment.javaws.jre.0.osarch=x86
deployment.javaws.jre.0.osname=Windows
deployment.javaws.jre.1.product=1.6.0_45
deployment.javaws.jre.0.platform=1.8
deployment.javaws.jre.0.path=C\:\\Program Files (x86)\\Java\\jre1.8.0_111\\bin\\javaw.exe
deployment.javaws.jre.0.location=http\://java.sun.com/products/autodl/j2se
deployment.javaws.jre.1.path=C\:\\Program Files (x86)\\Java\\jre6\\bin\\javaw.exe
deployment.javaws.jre.0.enabled=false
deployment.javaws.jre.1.osarch=x86
deployment.javaws.jre.1.osname=Windows
deployment.javaws.jre.1.platform=1.6
deployment.javaws.jre.0.product=1.8.0_111

在我的批处理文件中,我运行命令将任何包含单词product:

的行输出到文本文件
findstr /n "product" C:\myfile.txt > product.txt

文件始终为空,但该字符串存在于原始文本文件中。为什么显示空白?

1 个答案:

答案 0 :(得分:0)

试试这样!

Find /N ".product"<C:\myfile.txt>product.txt

显然,打印出这条线&#39;

Find ".product"<C:\myfile.txt>product.txt