Question bat to exe

d_a_r_k

Member
Joined
Oct 30, 2010
Messages
19
Programming Experience
Beginner
Hello people, Is there a way to import MS-DOS code into vb.net project and make it .exe out of .bat. Thanks.
 
Yup I was thinking the same. Ok so here's the code that I have

VB.NET:
Public Class Form1

    Dim batch As New Process

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Hide()
        Me.Visible = False
        My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\my_prog.bat", My.Resources.my_batch, False, System.Text.Encoding.Default)
        With batch.StartInfo
            .UseShellExecute = True
            .FileName = My.Computer.FileSystem.SpecialDirectories.Temp & "\my_prog.bat"
            .WorkingDirectory = Application.StartupPath
        End With
        End
    End Sub

End Class

But when I double click the .exe cmd windows doesn't show. Any ideas?
 
Is your question about how to run a bat file from a vb.net app? Or is it how to make a vb.net app that does what a bat file currently does?

If it's the former, using d_a_r_k's code, it's missing the Process.Start(batch) line. If it's the latter then you'll need to take a look at what the bat file does and build a program that does the same, which we can help you with the parts that you don't understand.
 
Back
Top