当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > 将VBS或ASP中的代码转成一句话形式

VBScript
VBS教程:方法-GetDrive 方法
VBS教程:方法-GetBaseName 方法
VBS教程:方法-GetAbsolutePathName 方法
VBS教程:方法-FolderExists 方法
VBS教程:方法-FileExists 方法
VBS教程:方法-Exists 方法
VBS教程:方法-DriveExists 方法
VBS教程:方法-DeleteFolder 方法
VBS教程:方法-DeleteFile 方法
VBS教程:方法-Delete 方法
VBS教程:方法-CreateTextFile 方法
VBS教程:方法-CreateFolder 方法
VBS教程:方法-CopyFolder 方法
VBS教程:方法-CopyFile 方法
VBS教程:方法-Copy 方法
VBS教程:方法-Close 方法
VBS教程:方法-BuildPath 方法
VBS教程:方法-AddFolders 方法(Folders)
VBS教程:方法-Add 方法(Dictionary)
VBS教程:VBScript 语句-With 语句

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-11   浏览: 69 ::
收藏到网摘: n/a

将VBS或ASP中的代码转成一句话形式 以前都以为直接把换行符换成冒号就可以了... 结果发现,有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!"