|
base64Decode.vbs
- Set oArgs = WScript.Arguments
- If oArgs.Count <> 2 Then
- WScript.Echo "Usage: {wscript | cscript} "& Wscript.ScriptName & " <encoded_file> <filename> " & vbCrLf
- Else
- Conv2Binary oArgs(0), oArgs(1)
- End If
- Set oArgs = Nothing
- Sub Conv2Binary(FileName, BinName)
- Set stream = CreateObject("ADODB.Stream")
- stream.Type = 2
- stream.Mode = 3
- stream.CharSet = "ASCII"
- stream.Open
- stream.LoadFromFile FileName
- Dim stream, xmldom, node
- Set xmldom = CreateObject("Microsoft.XMLDOM")
- Set node = xmldom.CreateElement("binary")
- node.DataType = "bin.base64"
- node.Text = stream.ReadText
- stream.Close
- stream.Type = 1
- stream.Mode = 3
- stream.Open
- stream.Position = 0
- stream.write node.NodeTypedValue
- stream.SetEOS
- stream.SaveToFile BinName, 2
- stream.Close
- Set stream = Nothing
- Set node = Nothing
- Set xmldom = Nothing
- End Sub
复制代码 |
|