OVH Cloud OVH Cloud

shell ou commande dos

3 réponses
Avatar
Johan Coffigniez
Bonjour,

je cherche à executer en C# une commande du type "shell" de VB.

> Shell "Ma commande dos" + "mes arguments";

J'ai bien songé aux process mais il doit bien y avoir plus simple ?


Merci
Bonne journée

3 réponses

Avatar
LEBRUN Thomas
L'équivalent de ce que tu cherches à faire est bien la classe Process:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp

A+

-------------------
LEBRUN Thomas
http://morpheus.developpez.com


"Johan Coffigniez" wrote:

Bonjour,

je cherche à executer en C# une commande du type "shell" de VB.

> Shell "Ma commande dos" + "mes arguments";

J'ai bien songé aux process mais il doit bien y avoir plus simple ?


Merci
Bonne journée






Avatar
Johan Coffigniez
Merci,
J'ai donc utilisé le Process.
Voici mon code simplifié pour ceux que ca interesse :

ProcessStartInfo startInfo = new ProcessStartInfo("net.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden; // Ca c cool , ca evite
d'avoir des apparition de fenetre dos!
startInfo.Arguments = "send " + ip + " " + message;
Process.Start(startInfo);

Thx and bye

"LEBRUN Thomas" wrote:

L'équivalent de ce que tu cherches à faire est bien la classe Process:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp

A+

-------------------
LEBRUN Thomas
http://morpheus.developpez.com


"Johan Coffigniez" wrote:

> Bonjour,
>
> je cherche à executer en C# une commande du type "shell" de VB.
>
> > Shell "Ma commande dos" + "mes arguments";
>
> J'ai bien songé aux process mais il doit bien y avoir plus simple ?
>
>
> Merci
> Bonne journée
>
>
>
>


Avatar
LEBRUN Thomas
A voir le code que tu as , tu as mis en place un net send :p

Si cela peut t'interesser, regarde ce code que j'ai fais à mes début :
http://www.csharpfr.com/code.aspx?ID709

Tu pourrais t'en inspirer si tu veux.

A+

-------------------
LEBRUN Thomas
http://morpheus.developpez.com


"Johan Coffigniez" wrote:

Merci,
J'ai donc utilisé le Process.
Voici mon code simplifié pour ceux que ca interesse :

ProcessStartInfo startInfo = new ProcessStartInfo("net.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden; // Ca c cool , ca evite
d'avoir des apparition de fenetre dos!
startInfo.Arguments = "send " + ip + " " + message;
Process.Start(startInfo);

Thx and bye

"LEBRUN Thomas" wrote:

> L'équivalent de ce que tu cherches à faire est bien la classe Process:
> http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp
>
> A+
>
> -------------------
> LEBRUN Thomas
> http://morpheus.developpez.com
>
>
> "Johan Coffigniez" wrote:
>
> > Bonjour,
> >
> > je cherche à executer en C# une commande du type "shell" de VB.
> >
> > > Shell "Ma commande dos" + "mes arguments";
> >
> > J'ai bien songé aux process mais il doit bien y avoir plus simple ?
> >
> >
> > Merci
> > Bonne journée
> >
> >
> >
> >