Using VBS to save the contents of a TXT suffix to HTML format



Copy codeThe code is as follows:
‘BY Coo_boi
If WScript.Arguments.Count=0 Then WScript.Quit
Dim fso,txt,htm
Set fso=CreateObject(“Scripting.FileSystemObject”)
Set htm=fso.CreateTextFile(txt&”.htm”,True)
MsgBox title
htm.WriteLine “<html>”
htm.WriteLine “<head>”
htm.WriteLine “<title>”&title&”</title>”
htm.WriteLine “</head>”
htm.WriteLine “<body>”
htm.WriteLine “<h1 align=center>”&title&”</h1>”
htm.WriteLine “<hr color=red>”
For Each line In Split(fso.OpenTextFile(txt).ReadAll ,vbCrLf)
htm.WriteLine line&”<br>”
htm.WriteLine “</body>”
htm.WriteLine “</html>”
Wscript. Echo “successfully converted txt to HTML”

Save the above code as do.vbs, and then drag 1.txt to do.vbs. You can generate the contents of TXT into HTML format, and have the effect of line wrapping.

Recommended Today

Comparison and analysis of Py = > redis and python operation redis syntax

preface R: For redis cli P: Redis for Python get ready pip install redis pool = redis.ConnectionPool(host=’′, port=6379, db=1) redis = redis.Redis(connection_pool=pool) Redis. All commands I have omitted all the following commands. If there are conflicts with Python built-in functions, I will add redis Global command Dbsize (number of returned keys) R: dbsize P: print(redis.dbsize()) […]