| | |
Code to execute a batch file
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
1
#2 Oct 20th, 2009
VB.NET Syntax (Toggle Plain Text)
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim p As New System.Diagnostics.Process() p.StartInfo.FileName = "C:\\test.bat" p.Start() End Sub
You can also call
p.WaitForExit() if you want your application to hold up until the bat file is done running. •
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 1
1
#3 Oct 20th, 2009
Try out this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process()
p.StartInfo.FileName = "E:\Users\Tom\Desktop\test.bat"
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
p.Start()
p.WaitForExit()
p.Close()
MessageBox.Show("App closed now")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process()
p.StartInfo.FileName = "E:\Users\Tom\Desktop\test.bat"
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
p.Start()
p.WaitForExit()
p.Close()
MessageBox.Show("App closed now")
End Sub
![]() |
Similar Threads
- how to pass text from a called vb script in a batch file (Visual Basic 4 / 5 / 6)
- getting crazy in trying to run a batch file! (C#)
- "Fishing" for and specific open task (C++)
- Creating a batch file to clear out Temp files (Windows NT / 2000 / XP)
- Running xsltproc batch file from vb.net app (VB.NET)
- gather a variable created in a batch file being executed. (Python)
- How can i suppress a user prompt while running a batch file in windows 2000 machin (Windows NT / 2000 / XP)
- Including header file in project?? (C++)
- Passing result codes to a batch file (Python)
- batch file help - extraction (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: How to display searched result in word
- Next Thread: save image in folder vb.net
Views: 415 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database databasesearch datagrid datagridview design designer dissertation dissertations dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy highlighting images inline insert installer intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project save searchbox searchvb.net select serial server soap sorting studio syntax table tcp text textbox time timer toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






