Home All Groups Group Topic Archive Search About

How to pass parameter?

Author
3 Mar 2006 5:24 AM
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

Author
3 Mar 2006 5:50 AM
Aboulfazl Hadi
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
Author
3 Mar 2006 6:50 AM
Chakravarti Mukesh
Hi,
Thanks it worked fined.  How would I kill the started process?

Bye
Mukesh

Show quoteHide quote
"Aboulfazl Hadi" <AHa***@gmail.com> wrote in message
news:1141365012.142878.250330@i39g2000cwa.googlegroups.com...
> 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
>
Author
3 Mar 2006 1:09 PM
Herfried K. Wagner [MVP]
"Chakravarti Mukesh" <cmuk***@sparshindia.com> schrieb:
> How would I kill the started process?

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

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

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
3 Mar 2006 6:44 AM
Homer J Simpson
Show quote Hide quote
"Chakravarti Mukesh" <cmuk***@sparshindia.com> wrote in message
news:eXsbPOoPGHA.964@tk2msftngp13.phx.gbl...
> 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)