![]() |
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,166 / 17 |
| Floor1 s11ss | Posted 2007-12-12 19:51 |
| 银牌会员 Posts 566 Credits 2,098 | |
|
How to use VBS code to find a certain string in a text file and write it to another file? (Output the lines containing the string)
[ Last edited by s11ss on 2007-12-14 at 04:24 PM ] |
|
| Floor2 vkill | Posted 2007-12-12 20:47 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
open file
str = read file colse flie str=~ |
|
| Floor3 s11ss | Posted 2007-12-12 21:10 |
| 银牌会员 Posts 566 Credits 2,098 | |
|
Does Brother vkill know if there is a clear screen command similar to cls when executing VBS with cscript?
|
|
| Floor4 vkill | Posted 2007-12-13 20:30 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
Originally posted by s11ss at 2007-12-12 21:10: Unknown, it seems that except for cmd, there is no screen-clearing function. |
|
| Floor5 zh159 | Posted 2007-12-13 20:48 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by vkill at 2007-12-13 20:30: hta can have ![]() |
|
| Floor6 jmz573515 | Posted 2007-12-13 21:37 |
| 银牌会员 Posts 464 Credits 1,212 | |
|
How to clear the screen in HTA?
|
|
| Floor7 lotus516 | Posted 2007-12-14 00:29 |
| 高级用户 Posts 246 Credits 551 | |
|
Can you explain the code in more detail?
|
|
| Floor8 zh159 | Posted 2007-12-14 02:09 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
It's not really clearing the screen, but replacing it with empty or hiding
![]() The running mode of HTA itself is different from batch processing |
|
| Floor9 fastslz | Posted 2007-12-14 15:00 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
|
Specify 1 character
|
|
| Floor10 zh159 | Posted 2007-12-14 15:39 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
The question is: Do you want to output the line that contains the character, or output that character if it exists?
|
|
| Floor11 s11ss | Posted 2007-12-14 16:23 |
| 银牌会员 Posts 566 Credits 2,098 | |
|
Please provide the specific content from the China DOS Union (中国DOS联盟) forum so that I can accurately output the line containing characters.
|
|
| Floor12 zh159 | Posted 2007-12-14 16:42 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
```vb
Set fso = CreateObject("Scripting.FileSystemObject") source = "a.txt" strFind = "b" Set f = fso.OpenTextFile(source, 1) While Not f.AtEndOfStream strRead = f.ReadLine If InStr(strRead, strFind) > 0 Then MsgBox strRead End If Wend f.Close ``` |
|
| Floor13 fastslz | Posted 2007-12-14 17:03 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
|
Which byte in the text, newline + 2
|
|
| Floor14 terse | Posted 2007-12-14 20:16 |
| 银牌会员 Posts 946 Credits 2,404 | |
|
Dig out an old post and post it up
|
|
| Floor15 lotus516 | Posted 2007-12-16 10:48 |
| 高级用户 Posts 246 Credits 551 | |
Originally posted by zh159 at 2007-12-14 16:42: |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |