Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Batch Converter to Executable.

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
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.

Full Source Download: http://www.mediafire.com/?6w5379u3j5m99j7
I don't trust this mostly because your reputation is -42 and you did not contain a virus scan .
(Aug 24, 2014 08:42 PM)FFadex Wrote:  I don't trust this mostly because your reputation is -42 and you did not contain a virus scan .

Reputation means nothing, also OP didn't post any executable. He posted source. What are you saying?
Need a custom software? Check out my freelance service here! 6+ years and counting, never a complaint :)

STOP STEALING CODE.

FREE NATHAN

People who report posts are lamers.
(Aug 24, 2014 09:12 PM)idb. Wrote:  Reputation means nothing, also OP didn't post any executable. He posted source. What are you saying?

The only rep that matters is seller or buyer rep relevant to the subject. So yes, rep means something.
[Image: giphy.gif?cid=790b7611b007c1bdd2cd47171b...y.gif&ct=g]
(Aug 24, 2014 08:42 PM)FFadex Wrote:  I don't trust this mostly because your reputation is -42 and you did not contain a virus scan .

Yeah cuz his reputation is totally correlated towards his need to infect members
(Aug 24, 2014 08:42 PM)FFadex Wrote:  I don't trust this mostly because your reputation is -42 and you did not contain a virus scan .
Rep is saying "LQ member", "Insulting others", "User is a d!ck", etc... Nothing about "Infecting other members".
I have this idea in my mind that this was a copy paste or just the code is not really clean? Still, gonna bookmark this; might work.
OP, I must say, great idea. Haven't seen really the code, but looking at the code in the code tag for a sec, it let's me know that it could be better. For example, try to use "using" statements. Try to use System.IO instead of My.Computer.FileSystem, a lot of people say that it's outdated, and I personally don't like it. That includes FileOpen, FilePut and FileClose. I see that you use a thread sleep there, that will only make the GUI freeze for a second, and that 1 sec interval will never be precise enough, it sometimes might take a bit longer than usual to run the object before the sleep, and then the next object will most likely fail. Further more there is "Else End Sub", you don't need that because if the if statement fails, it will go to the next line after end if, and what is that, End Sub. So you are just repeating the already implemented "feature". And for the code structure, do not leave empty methods like you did in the above example with the Button5. Try to have a bit more user-friendly names. Follow the naming conventions(I cannot speak for this, because I'm terrible at it, but meeh). And last, but not least, do not, leave empty lines all over the place for no reason. It just makes the code hard to read. All in all, this looks to me like a VB6 ripoff converted, just to be converted into VB.Net. I hope you learn something from my suggestions,.

Best of luck,
-Electroalek
(Aug 24, 2014 09:28 PM)Tostig Wrote:  The only rep that matters is seller or buyer rep relevant to the subject. So yes, rep means something.

If the only people that gave out rep was admins/mods it would mean something. I've seen too much rep being given out for things that are meaningless "hey you like edm too!" "i like your username!" "you're from sweden too!" "were friends!".

I've ran into several very HQ members of this forum that didn't have an elevated account (l33t/ub3r/ep1c) and had low/negative rep... it doesn't make them any less skilled/talented than someone with a shitload of rep. Matter of fact, theres a lot of folks around here with very high rep that aren't worth their weight in salt. Rep means nothing. I do appreciate the +1 though. Very kind of you, sir. lol.
Need a custom software? Check out my freelance service here! 6+ years and counting, never a complaint :)

STOP STEALING CODE.

FREE NATHAN

People who report posts are lamers.
(Aug 25, 2014 06:32 AM)SIM-1456245 Wrote:  OP, I must say, great idea. Haven't seen really the code, but looking at the code in the code tag for a sec, it let's me know that it could be better. For example, try to use "using" statements. Try to use System.IO instead of My.Computer.FileSystem, a lot of people say that it's outdated, and I personally don't like it. That includes FileOpen, FilePut and FileClose. I see that you use a thread sleep there, that will only make the GUI freeze for a second, and that 1 sec interval will never be precise enough, it sometimes might take a bit longer than usual to run the object before the sleep, and then the next object will most likely fail. Further more there is "Else End Sub", you don't need that because if the if statement fails, it will go to the next line after end if, and what is that, End Sub. So you are just repeating the already implemented "feature". And for the code structure, do not leave empty methods like you did in the above example with the Button5. Try to have a bit more user-friendly names. Follow the naming conventions(I cannot speak for this, because I'm terrible at it, but meeh). And last, but not least, do not, leave empty lines all over the place for no reason. It just makes the code hard to read. All in all, this looks to me like a VB6 ripoff converted, just to be converted into VB.Net. I hope you learn something from my suggestions,.

Best of luck,
-Electroalek

I definitely agree.
Why do people use My.Computer.FileSystem anymore? It is MUCH MORE EASIER using System.IO
I had one of these a couple of year back, great to see someone made a better one :D
[Image: SMnpQ4d.gif]
Seeing this for the second time and with a second though, why go through all the trouble when you can store the batch code in a variable and then execute it dinamically by passing it as a /c argument to cmd
exe


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 220 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Shell] by fisica638Oct 30, 2019 11:05 AM 1 536 Oct 30, 2019 11:05 AM
Last Post: Hackoo
[Shell] by mrck10Sep 5, 2017 12:08 PM 3 428 Sep 5, 2017 12:08 PM
Last Post: LegoStoppro