To run program from command prompt interface
Writing a program in VB.Net
I want to run a file using an application called "Hello" in command prompt.
here is the code.
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click OpenFileDialog1.Title = "Please select .xml file" OpenFileDialog1.Filter = "xml files|*.xml" OpenFileDialog1.ShowDialog() If OpenFileDialog1.FileName <> "" Then TextBox1.Text = (OpenFileDialog1.FileName) End If End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim filepath As String = (TextBox1.Text) Diagnostics.Process.Start("cmd /k hello", filepath) End Sub
Re: To run program from command prompt interface
Process takes a file to execute in the call you are using. You are passing
the entire command line, which is why it did not work.
If I were you I would do it as follows:
Dim p As New Process
p.StartInfo.FileName = "cmd"
p.StartInfo.Arguments = "/k hello TheInputFile"
|Tags: command prompt interface, vb express|
|Thread Tools||Search this Thread|
|Similar Threads for: "To run program from command prompt interface"|
|Thread||Thread Starter||Forum||Replies||Last Post|
|command prompt problem||arshadmahmood||Operating Systems||1||03-07-2010 12:33 AM|
|Command Prompt does not open||Custidio||Operating Systems||3||31-10-2009 07:46 PM|
|about the command prompt||Gorganzola||Windows Software||2||17-10-2008 06:24 PM|
|Command prompt "COPY" command not working in brand new Windows Vis||CMD COPY command not working in Vista||Vista Help||7||06-02-2008 02:50 AM|
|Set Affinity using command email@example.com||Vista Help||3||23-12-2007 05:09 AM|