-3

I'm trying to make a simple VB program. I just want it to embed into it a running batch program. I'm asking if there is a way to do that.

So to break it down could i take a batch file and embed it into the program. So it would kind of be like this except its not two windows: http://gyazo.com/72652af4dfc04cd379ee11ed0de165e2

John
  • 23
  • 5

1 Answers1

-2

1) It's probably silly to have a separate .bat file if you can do everything you want directly in the VB program. Have you considered just incorporating the functionality directly in VB?

2) To run a separate .bat file from VB.Net, perhaps the easiest way is to use Process.start().

EXAMPLE: System.Diagnostics.Process.Start("c:\path\to\myfile.bat")

3) Finally, you can always a) create a text file (with a .bat suffix and your .bat commands) on the fly, then call "Process.Start()" on your dynamically-created .bat file.

PS:

I assume by "VB" you probably mean "VB.Net". If you mean "VB6", the API would be "Shell()". For example: Shell("c:\path\to\myfile.bat", vbHide).

FoggyDay
  • 11,962
  • 4
  • 34
  • 48
  • Wait, But is there a way to embed the output in the program?? – John Jan 01 '15 at 00:55
  • Q: What exactly do you mean "embed the output in the program"? Can you give an example? – FoggyDay Jan 01 '15 at 00:56
  • PS: Strong suggestion - please re-word your post. I think there's a valid question in there. I'm disappointed in the anal retentive trolls who marked you down and closed it without asking you to elaborate. – FoggyDay Jan 01 '15 at 01:00
  • Reworded, added detail – John Jan 01 '15 at 01:21
  • Sorry - I'm still not sure what you're asking for :( – FoggyDay Jan 01 '15 at 01:22
  • Ok so you know like JFrame were you can embed webpages. I want to embed a batch file in a vb program. so instead of web pages, like batch files – John Jan 01 '15 at 01:30
  • 1
    You may start the batch file as a new process and then capture the output. http://stackoverflow.com/questions/186822/capturing-console-output-from-a-net-application-c – Jens Jan 01 '15 at 01:38