hannir hannir -5 years ago 205
Vb.net Question

How to run BATCH code in VB.NET?

I'd like to run some batch code when click on an button.
The thing is I want to create the batch file in VB.NET and not use external batch file.

Finally I want run this batch code - shown in an RichTextBox.

Also - is it possible to change some variables...I mean, for example

$program = "selectedfromlistbox" (in batch.bat)

depends on which "software" was selected in an ListBox.

So I need to paste the ListBox selection into batch.

Hope u understand :)
Thx for ur help!


Answer Source

You can not run batch code within your application just like that.

You should create a temporary batch file (which then can be customized with values selected in your application) and execute that using the Process class.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download