Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Exemple d’utilisation de la class ‘Process’ pour lancer et rediriger une processus locale

Utilitaire,Plateforme:,non,edité
{filelink=17867}

using System;
using System.Diagnostics;
 
public class ExempleProcess
{
    public static void Main()
    {
        Process process = new Process();
        process.StartInfo.FileName = "cmd.exe";
        // Argument de ligne de commande
        process.StartInfo.Arguments = "/c dir *.cs";
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.RedirectStandardOutput = true;
        process.Start();
 
        string output = process.StandardOutput.ReadToEnd();
 
        Console.WriteLine("Affichage:n{0}",output);
    }
}

No comments yet.

Leave a Comment