View Single Post
Old 27th April 2016, 19:13   #3626  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
@MA

The first was perfect, this one encodes but the console output looks wrong:



My code works for all other tools:

Code:
Overloads Sub Encode(passName As String, batchCode As String)
    batchCode = "@echo off" + BR + "CHCP 65001" + BR + batchCode
    Dim batchPath = p.TempDir + p.TargetFile.Base + "_encode.bat"
    File.WriteAllText(batchPath, batchCode, New UTF8Encoding(False)) 'UTF8 without BOM

    Using proc As New Proc
        proc.Init(passName)
        proc.Encoding = Encoding.UTF8
        proc.File = "cmd.exe"
        proc.Arguments = "/C call """ + batchPath + """"
        proc.Start()
    End Using
End Sub

Last edited by stax76; 27th April 2016 at 19:17.
stax76 is offline   Reply With Quote