欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

将VBS或ASP中的代码转成一句话形式

程序员文章站 2022-07-04 20:26:58
结果发现,有table不行 类似if xx=1 then yy=2 的也不行... //此脚本支持拖放,也可以在命令行下使用 cscript change.vbs xx.a...
结果发现,有table不行
类似if xx=1 then yy=2 的也不行...

//此脚本支持拖放,也可以在命令行下使用 cscript change.vbs xx.asp
复制代码 代码如下:

on error resume next
set arg=wscript.arguments
if arg.count=0 then wscript.quit
'code by netpatch
'enjoy it
set fso=createobject("scripting.filesystemobject")
set file=fso.opentextfile(arg(0),1,false,-2)
set files=fso.opentextfile(arg(0)&".vbs",2,true)
do while file.atendofstream <> true
szbuf=file.readline
szbuf=replace(szbuf,chr(9),"")
findnum=instr(lcase(szbuf),"then")
if findnum >0 then
findnum=findnum+3
if len(szbuf) > findnum then
szbuf=szbuf&":end if"
end if
end if
files.write szbuf&":"
loop
file.close
files.close
set fso=nothing
wscript.echo "ok!"