China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-30 22:23
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » findstr question: How to find "\"??? View 2,777 Replies 17
Original Poster Posted 2007-03-15 06:37 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline


E:\DOS>set abc=abc E:\123 1111

E:\DOS>echo %abc%|findstr "E"
abc E:\123 1111

E:\DOS>echo %abc%|findstr "E:"
abc E:\123 1111

E:\DOS>echo %abc%|findstr "E:\"

E:\DOS>


Why can't E:\ be found???

[ Last edited by xycoordinate on 2007-3-14 at 09:29 PM ]
Floor 2 Posted 2007-03-15 06:54 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Try this
@echo off
set abc=abc E:\123 1111
echo %abc%|findstr "E\\"
pause
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 3 Posted 2007-03-15 10:32 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
Originally posted by ccwan at 2007-3-14 17:54:
Try this
@echo off
set abc=abc E:\123 1111
echo %abc%|findstr "E:\\
pause


Thank you, ccwan!

Under your reminder, I looked at
findstr /?
Found:
\x Escape: literal usage of metacharacter x

[ Last edited by xycoordinate on 2009-7-7 at 05:28 ]
Floor 4 Posted 2007-03-21 02:10 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
Then how to use findstr to query "space"?
Floor 5 Posted 2007-03-21 02:29 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
It should be like this
@echo off
set abc=abc def
echo %abc%|findstr /c:" "
pause


Wait, no, the original "findstr /c:" " is correct. The correct translation should be:

It should be like this
@echo off
set abc=abc def
echo %abc%|findstr /c:" "
pause
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 6 Posted 2007-03-22 07:36 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
Originally posted by ccwan at 2007-3-20 13:29:
It should be like this
@echo off
set abc=abc def
echo %abc%|findstr /c:" "
pause


Thank you! find can also be used!

F:\>set abc=123 456

F:\>echo %abc%|findstr /c:" "
123 456

F:\>echo %abc%|find " "
123 456
Floor 7 Posted 2007-03-24 21:35 ·  中国 上海 普陀区 电信
新手上路
Credits 8
Posts 4
Joined 2007-03-24 20:43
19-year member
UID 82792
Gender Male
Status Offline
Floor 8 Posted 2007-03-24 21:35 ·  中国 上海 普陀区 电信
新手上路
Credits 8
Posts 4
Joined 2007-03-24 20:43
19-year member
UID 82792
Gender Male
Status Offline
Floor 9 Posted 2007-03-24 21:35 ·  中国 上海 普陀区 电信
新手上路
Credits 8
Posts 4
Joined 2007-03-24 20:43
19-year member
UID 82792
Gender Male
Status Offline
Floor 10 Posted 2008-01-26 04:51 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
Then how to use findstr or find to search for the period "." in English state?
Floor 11 Posted 2008-01-26 09:41 ·  中国 吉林 吉林市 联通
初级用户
Credits 68
Posts 32
Joined 2007-12-09 17:16
18-year member
UID 105152
Gender Male
Status Offline
```@echo off
set abc=abc de.f
echo %abc%|findstr /c:"\."
pause
```
Floor 12 Posted 2008-01-26 14:43 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
Brother qianmo717,
Thanks
Learned it,
Floor 13 Posted 2008-05-10 11:03 ·  中国 北京 联通
初级用户
Credits 28
Posts 15
Joined 2008-04-28 09:18
18-year member
UID 117150
Gender Male
Status Offline
Floor 14 Posted 2008-05-10 11:22 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Floor 15 Posted 2008-05-10 11:29 ·  中国 北京 联通
初级用户
Credits 28
Posts 15
Joined 2008-04-28 09:18
18-year member
UID 117150
Gender Male
Status Offline
But when I run the following code, it always prompts "The command syntax is incorrect"
echo ^>|findstr "\>" &&echo ok
Forum Jump: