![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-06 22:56 |
48,040 topics / 350,125 posts / today 1 new / 48,252 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] How to use VBS code to implement finding and writing strings? |
| Printable Version 2,167 / 17 |
| Floor16 zh159 | Posted 2007-12-16 14:44 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
```code
Set fso = CreateObject("Scripting.FileSystemObject") source = "a.txt" strFind = "a,b,c,d,e,f" strFind = Split(strFind, ",") Num = UBound(strFind) Set f = fso.OpenTextFile(source, 1) While Not f.AtEndOfStream strRead = f.ReadLine For i = 0 To Num If InStr(strRead, strFind(i)) > 0 Then MsgBox strRead End If Next Wend f.Close ``` The characters searched here are case-sensitive (it performs a binary comparison, for specific details, refer to the InStr usage) [ Last edited by zh159 on 2007-12-16 at 02:46 PM ] |
|
| Floor17 lotus516 | Posted 2007-12-17 08:12 |
| 高级用户 Posts 246 Credits 551 | |
Originally posted by zh159 at 2007-12-16 14:44: |
|
| Floor18 zh159 | Posted 2007-12-17 10:06 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by lotus516 at 2007-12-17 08:12: |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |