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-08-12 14:16
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Text search: compare characters View 656 Replies 1
Original Poster Posted 2009-09-30 13:34 ·  中国 湖北 武汉 电信
新手上路
Credits 6
Posts 6
Joined 2008-05-11 19:07
18-year member
UID 118436
Gender Male
Status Offline
I’d like to ask for a batch file to implement the following function:
I already have a text file ID.txt, with no spaces on each line, and its contents are for example:
abc
system
2753
60th anniversary

Then I want to use the command set /p= to input text, any text is fine, and compare the input text with these strings in ID.txt. If the input text contains any of the above strings, then exit.
For example, if I input "system file" or "system", since it contains "system", then it matches the condition above, so it should exit.
But if I only input "sys" or “series”, then it does not match the condition above, and should not exit.

Please, experts, help!

[ Last edited by q115643492 on 2009-9-30 at 14:59 ]
Floor 2 Posted 2009-09-30 15:48 ·  中国 广东 广州 花都区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
49206C6F766520796F752067757973 54656C3A3133383238343036373837
Forum Jump: