Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run batch file in vb.net?

Tags:

vb.net

How can I run a batch from from within vb.net?

like image 387
Alex Avatar asked Feb 01 '10 17:02

Alex


2 Answers

You can use the Process class to run a batch file

Dim psi As New ProcessStartInfo("Path TO Batch File")
psi.RedirectStandardError = True
psi.RedirectStandardOutput = True
psi.CreateNoWindow = False
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.UseShellExecute = False

Dim process As Process = Process.Start(psi)
like image 56
RHicke Avatar answered Oct 30 '22 10:10

RHicke


Here is a simple and straight forward method:

System.Diagnostics.Process.Start("c:\batch.bat")
like image 30
Vivek Bernard Avatar answered Oct 30 '22 10:10

Vivek Bernard