
CODE: [Copy to clipboard]无参数弹出对话框提示输入代码,有参数则自动转换,无临时文件,vbs版,可在bat中用cscript.exe //nologo调用。If WScript.Arguments.Count < 1 Then
str = InputBox("输入源码:","提示")
Else
str = WScript.Arguments(0)
End If
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate "about:blank"
oIE.Document.write "<html><body></body></html>"
oIE.Document.body.innerHTML = str
WScript.Echo oIE.Document.body.innerText
| Quote: | |
|
CODE: [Copy to clipboard]vbs版的,也是正则表达式,不知道是否和你的要求相符。另外,还有一种vbs方案,对代码要求较高,不规范(xhtml规范)的代码无法得到正常结果:strFilter = "<[^>]+>"
WScript.echo HtmlFilter(InputBox("输入字符串:"),strFilter)
Function HtmlFilter(str,pattern)
Set regEx = New RegExp
With regEx
.Global = True
.IgnoreCase = True
.Pattern = pattern
HtmlFilter = .Replace(str,"")
End With
End Function
CODE: [Copy to clipboard]Set oXML = CreateObject("Microsoft.XMLDOM")
With oXML
.loadXML InputBox("请输入字符串:")
WScript.Echo .text
End With
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |