Results 1 to 1 of 1

Thread: [RESOLVED]Packaging and running a .bat/.cmd with VB

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Location
    Amsterdam, NY
    Posts
    85

    Resolved [RESOLVED]Packaging and running a .bat/.cmd with VB

    Hello, I can currently run an EXTERNAL batch file with VB, but I would like very much to make my program just one file ( so I don't need people to install it )

    I added test.cmd to my resources (it shows up as a .txt under properties though) *just a note, it is a .cmd file because I can run it from windows fine*

    Is there anyway to run a batch/cmd file that is packaged with the VB.exe

    I'm trying to use the command:


    System.Diagnostics.Process.Start(My.Resources.test)


    I tried with and without the .cmd extension on it

    If there is no way to do this, is there anyway I can display the output from the batch in VB itself?

    -Like using a picturebox or something then passing DOS commands in VB to it, and having the picturebox display the output of what you would normally see inside the regular DOS window when running a batch file.

    *I did not look for how to do that yet, but I am going to start after I post this, and will reply if I find anything of use.


    *Here is my resolution to it:

    Code:
    Dim objStreamWriter As StreamWriter
    
                    objStreamWriter = New StreamWriter("C:\test.bat") 
    
                    objStreamWriter.WriteLine("COMMAND") 'repeat for EVERY COMMAND in the batch file....
                     **more commands**
                    objStreamWriter.Close() 'Close the file.
    
                    System.Diagnostics.Process.Start("C:\test.bat")
    then i delete the batch file in a later sub.
    Last edited by patplays852; Jul 28th, 2009 at 08:23 PM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width