Try the code below:
Const FsoTristateUseDefault = -2 ' Opens the file using the system default.
Const FsoTristateTrue = -1 ' Opens the file as Unicode.
Const FsoTristateFalse = 0 ' Opens the file as ASCII.
' some operations
sUsername = "username"
sPassword = "12345"
' set path to default.html
sScriptFolder = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\"
sDefaultPath = sScriptFolder & "default.html"
' read default
sDefaultContent = ReadTextFile(sDefaultPath, FsoTristateUseDefault)
' processing some data to get result
sResult = ""
sResult = sResult & "<!-- """ & Username & """-->" & vbCrLf
sResult = sResult & " " & vbCrLf
sResult = sResult & sDefaultContent
' write result to new file, as Unicode
WriteTextFile sResult, Trim(sUsername) & Trim(sPassword) & ".html", FsoTristateTrue
Function ReadTextFile(sPath, iFormat)
With CreateObject("Scripting.FileSystemObject").OpenTextFile(sPath, 1, False, iFormat)
ReadTextFile = ""
If Not .AtEndOfStream Then ReadTextFile = .ReadAll
.Close
End With
End Function
Sub WriteTextFile(sCont, sPath, iFormat)
With CreateObject("Scripting.FileSystemObject").OpenTextFile(sPath, 2, True, iFormat)
.Write(sCont)
.Close
End With
End Sub
Note if you need to open file e. g. in UTF-8, you have to use another tools like ADODB.Stream