How to pass parameter?

  • Thread starter Thread starter Chakravarti Mukesh
  • Start date Start date
C

Chakravarti Mukesh

Hi
I want to call an application and also need to pass some parameter for it.
I use
System.Diagnostics.Process.Start("application_path")

and it runs perfectly. But when I pass paramenter like

System.Diagnostics.Process.Start("application_path -parameter1 -parameter2")

it says that the file doesn't exist. How should I pass parameter?

Thanks
 
Hi
For starting a process with command line arguments you can use other
overloads of Process Class :

Process.Start(fileName, arguments)
So :

System.Diagnostics.Process.Start("application_path ","-parameter1
-parameter2")


Or you can use Process.StartInfo.Arguments .

I hope this helps
A.Hadi
 
Chakravarti Mukesh said:
Hi
I want to call an application and also need to pass some parameter for it.
I use
System.Diagnostics.Process.Start("application_path")

and it runs perfectly. But when I pass paramenter like

System.Diagnostics.Process.Start("application_path -parameter1 -parameter2")

it says that the file doesn't exist. How should I pass parameter?

Thanks

System.Diagnostics.Process.Start("application_path" -parameter1 -parameter2)
 
Hi,
Thanks it worked fined. How would I kill the started process?

Bye
Mukesh
 
Chakravarti Mukesh said:
How would I kill the started process?

\\\
Dim p As Process = Process.Start(...)
....

' Better: 'CloseMainWindow' for applications which have a
' main window.
p.Kill()
///
 
Back
Top