标题: findstr 用法的疑惑??
[打印本页]
作者: mmh1
时间: 2009-4-13 22:23
标题: findstr 用法的疑惑??
wmic process get executablepath>1.txt
ping /n 3 127.1>nul
findstr "explorer.exe" 1.txt>2.txt
1.txt文件里面有东西,为什么2.txt里面是空的呢???
我用在其他地方好像可以findstrd到,为什么在这个例子里就不行?
是不是特殊符号的影响?
[
Last edited by mmh1 on 2009-4-13 at 22:48 ]
作者: deaniqpl
时间: 2009-4-13 22:46
沙发顶一个,也正学习中。
作者: mmh1
时间: 2009-4-13 22:49
@echo off
color 5f
tasklist>1.txt
cls
findstr "explorer" 1.txt>2.txt
taskkill /f /im explorer.exe
cls
ping /n 4 127.1>nul
for /f %%i in (2.txt) do start %%i
这个例子里的findstr可以用
作者: 不得不爱
时间: 2009-4-13 23:06
应该是与findstr所支持的文件编码有关
wmic process get executablepath>1.txt回产生unicode格式的文件,而findstr不能正常处理引起的.
wmic process get executablepath>1.txt
type 1.txt|findstr/i "explorer.exe" >2.txt
这样就可以了
[
Last edited by 不得不爱 on 2009-4-13 at 23:08 ]
作者: mmh1
时间: 2009-4-13 23:17
原来是这样,我先试试
作者: mmh1
时间: 2009-4-13 23:18
可以用,谢谢了!!
作者: everest79
时间: 2009-4-14 04:47
1
wmic process where name='explorer.exe' get executablepath
2
type 1.txt|findstr /i "explorer.exe"
作者: echoair
时间: 2009-11-11 13:09
type的用法…