Home All Groups Group Topic Archive Search About
Author
3 Jan 2007 2:39 PM
George Varelas
Hi,
can anyone tell me how can I execute an external command such as dos command
through my windows application which is built in C#.

VB has the "Shell(...)" function but I couldn't find something like this in
C#.

Thanks
George

Author
3 Jan 2007 3:04 PM
Henning Krause [MVP - Exchange]
Hello,

you can use the Process.Start() method to to this.

Best regards,
Henning Krause

Show quote
"George Varelas" <gvare***@casinorio.gr> wrote in message
news:OJvc6T0LHHA.5104@TK2MSFTNGP06.phx.gbl...
> Hi,
> can anyone tell me how can I execute an external command such as dos
> command through my windows application which is built in C#.
>
> VB has the "Shell(...)" function but I couldn't find something like this
> in C#.
>
> Thanks
> George
>
>
Author
4 Jan 2007 11:06 AM
Mubashir Khan
Henning:
Is Process.Start() equivalent to ShellEcecute() or rather CreateProcess()

Show quote
"Henning Krause [MVP - Exchange]" <newsgroups_rem***@this.infinitec.de>
wrote in message news:%23kvXuh0LHHA.4712@TK2MSFTNGP04.phx.gbl...
> Hello,
>
> you can use the Process.Start() method to to this.
>
> Best regards,
> Henning Krause
>
> "George Varelas" <gvare***@casinorio.gr> wrote in message
> news:OJvc6T0LHHA.5104@TK2MSFTNGP06.phx.gbl...
>> Hi,
>> can anyone tell me how can I execute an external command such as dos
>> command through my windows application which is built in C#.
>>
>> VB has the "Shell(...)" function but I couldn't find something like this
>> in C#.
>>
>> Thanks
>> George
>>
>>
>
Author
4 Jan 2007 11:19 AM
Henning Krause [MVP - Exchange]
Hello,

it depends... :-)

You can pass a ProcessStartInfo to the method.  And this class has a
property UseShellExecute. If set to true, it will use ShellExecute,
otherwise it will do a CreateProcess.

But if you specify a username and password (.NET 2.0 only), it will run the
process under those specified credentials with the CreateProcess behavior.
ShellExecute=true is not possible in this scenario.

Best regards,
Henning Krause


Show quote
"Mubashir Khan" <m***@yahoo.com> wrote in message
news:eEe07B$LHHA.2456@TK2MSFTNGP06.phx.gbl...
> Henning:
> Is Process.Start() equivalent to ShellEcecute() or rather CreateProcess()
>
> "Henning Krause [MVP - Exchange]" <newsgroups_rem***@this.infinitec.de>
> wrote in message news:%23kvXuh0LHHA.4712@TK2MSFTNGP04.phx.gbl...
>> Hello,
>>
>> you can use the Process.Start() method to to this.
>>
>> Best regards,
>> Henning Krause
>>
>> "George Varelas" <gvare***@casinorio.gr> wrote in message
>> news:OJvc6T0LHHA.5104@TK2MSFTNGP06.phx.gbl...
>>> Hi,
>>> can anyone tell me how can I execute an external command such as dos
>>> command through my windows application which is built in C#.
>>>
>>> VB has the "Shell(...)" function but I couldn't find something like this
>>> in C#.
>>>
>>> Thanks
>>> George
>>>
>>>
>>
>
>

AddThis Social Bookmark Button