DOS批处理替换,删除字符

来源:百度知道 编辑:UC知道 时间:2024/05/31 23:52:49
我最近更新域名了,由于纯静态的网页,我需要替换网址,还在删除修改一些广告代码。
是否可以帮我弄一个批处理来批量修改*.htm 比如批量替换,批量删除,批量删除某两个字符串之间的内容?

将以下内容保存为vbs文件。将你所有的.htm文件拖到这个vbs文件上会弹出对话框。替换你字符串。

'on error resume next
set arg=WScript.Arguments
if arg.count=0 then
msgbox "Usage:"&vbcrlf&vbcrlf&" 不要直接运行这个脚本,把需要进行字符串替换的一个或多个文件拖曳到这个脚本文件上来就可以了。",,"批量文件字符串替换器 By 有脑分析"
wscript.quit
end if
do
content1=inputbox("请输入你要替换的字符串","批量文件字符串替换器")
if isempty(content1) then
respond=msgbox("EXIT?",1)
if respond=1 then
wscript.quit
end if
elseif content1<>"" then
exit do
end if
msgbox "你没有输入你要替换的字符串呀!",,"批量文件字符串替换器"
loop
do
content2=inputbox("想把"""&content1&"""替换成什么呀?","批量文件字符串替换器")
if isempty(content2) then
respond=msgbox("EXIT?",1)
if respond=1 then
wscript.quit
end if
else
exit do
end if
loop
set fso=crea