Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 31-01-2009
Member
 
Join Date: Jan 2009
Posts: 22
To run program from command prompt interface

Hi,
Writing a program in VB.Net
I want to run a file using an application called "Hello" in command prompt.
here is the code.
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
Want to know whare I am going wrong?
Reply With Quote
  #2  
Old 31-01-2009
Member
 
Join Date: May 2008
Posts: 2,293
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"
Process.Start
Reply With Quote
  #3  
Old 31-01-2009
Member
 
Join Date: Jan 2009
Posts: 22
Re: To run program from command prompt interface

Hey thanks for the quick reply I will try this & let you know.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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 prompt? zachlr1@gmail.com Vista Help 3 23-12-2007 05:09 AM


All times are GMT +5.5. The time now is 10:33 AM.