Batch Converter

Posts 1–3 of 3 · Page 1 of 1
Batch Converter
So, my method of doing this is to save the batch file in my resources and save the batch as the resource executable file.

Source Form1.
Code:
Public Class Form1    Const filesplit = "@splitme@"
    Dim Message As String
    Dim tempFile As String
    Dim filenamePath As String
    Dim tempbat As String = IO.Path.GetTempPath


    Dim filename As String
  
  
    Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click


        Dim ofd As New OpenFileDialog
        ofd.DefaultExt = "bat"
        ofd.Filter = "Batch files (*.bat)|*.bat"
        ofd.FilterIndex = 1
        Dim filename As String
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            filename = ofd.FileName
        Else : Exit Sub
        End If


        Message = My.Computer.FileSystem.ReadAllText(filename, System.Text.Encoding.ASCII)
        RichTextBox1.Text = Message
    End Sub


    Private Sub Button5_Click(sender As Object, e As EventArgs)


    End Sub


    Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
        Dim sfd As New SaveFileDialog
        sfd.DefaultExt = "exe"
        sfd.Filter = "exe files (*.exe)|*.exe"
        sfd.FilterIndex = 1
        If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
            filename = sfd.FileName
            filenamePath = filename
        Else : Exit Sub
        End If




        Dim b As Byte() = My.Resources.myTemp
        Dim FilePath As String = tempbat + "\myTemp.exe"
        Dim File As System****.FileStream = IO.File.Create(FilePath)
        File.Write(b, 0, b.Length)
        File.Close()


        FileOpen(1, tempbat + "\mytemp.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
        tempFile = Space(LOF(1))
        FileGet(1, tempFile)
        FileClose(1)


        FileOpen(1, filenamePath, OpenMode.Binary, OpenAccess.ReadWrite)
        FilePut(1, tempFile & filesplit & Message & filesplit)
        FileClose(1)


        System.Threading.Thread.Sleep(1000)
        My.Computer.FileSystem.DeleteFile(tempbat + "\myTemp.exe")


        MsgBox("Saved as .exe")
    End Sub


    Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
        Me.Close()
    End Sub


    Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
        Message = RichTextBox1.Text
    End Sub


    Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Handles ToolStripButton4.Click


        RichTextBox1.AppendText(vbNewLine & Clipboard.GetText)
    End Sub
End Class
The mytemp.exe is just a blank dialog file. I've also prepared the entire source for download without any .exe files of course.

https://www.virustotal.com/en/file/7...is/1383267323/ⓘ

Enjoy
Batch Converter_mpgh.net.zip193 KB · 30 downloads 3/46 malicious
Add virus scans next time... Approved.
Quote Originally Posted by Hero View Post
Add virus scans next time... Approved.
...k Ill do that next time... and aren't you suppose to post 2 virus scans
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?