![]() |
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-09-25 01:05 |
47,813 topics / 349,918 posts / today 1 new / 48,274 members |
| DOS批处理 & 脚本技术(批处理室) » Help, a batch file to replace specified characters in ASP files? |
| Printable Version 1,308 / 6 |
| Floor1 vcstone | Posted 2007-04-09 12:32 |
| 初级用户 Posts 39 Credits 98 | |
|
Environment: windows xp command prompt
Requirement: automatically search and replace (here, use SB_ to replace) the specified characters (here, admin_) in all ASP files in the same folder Or it would also be fine to directly search all ASP files for the "admin_" string and then delete it. One more small request: it'd be best if you could add a few comments to the program, because I'm learning batch files now too, and I hope it can help me understand the program a bit. Thanks. |
|
| Floor2 lxmxn | Posted 2007-04-09 15:12 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Not tested. If there are problems, reply and discuss... |
|
| Floor3 3391617 | Posted 2007-04-09 21:32 |
| 初级用户 Posts 56 Credits 116 | |
|
I'll learn from this too, so ASP can do this as well~~
|
|
| Floor4 vcstone | Posted 2007-04-10 06:04 |
| 初级用户 Posts 39 Credits 98 | |
|
Thanks in advance, I'll test it when I get back tonight..
|
|
| Floor5 vcstone | Posted 2007-04-10 10:03 |
| 初级用户 Posts 39 Credits 98 | |
|
Expert, I tried it and it doesn't work. After running it, it creates several ASP files with the same content as the files that need to be modified, but the parts that should be changed have not changed
|
|
| Floor6 lxmxn | Posted 2007-04-10 12:51 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Re vcstone: I tested it. The batch file above does work, but I improved it again and it will delete blank lines. See the code below: Note: it can only replace the "SB" characters inside. Characters like "sb", "Sb", or "sB" cannot be replaced. Try again. |
|
| Floor7 vcstone | Posted 2007-04-11 03:11 |
| 初级用户 Posts 39 Credits 98 | |
|
It works now.. Thanks first! I still don't understand the program very well for the moment, I'll go back and study it a bit. If I have questions I'll ask you again.
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |