run command prompt commands from within a C# application

15
12



run command prompt commands from within a C# application
————-
May be you like this
————–
Our channel:

Interest to donate :

RavenDB playlist here:
KnockoutJs Playlist:

Wcf playlist :

Wcf restful playlist :

Angularjs playlist :

c# playlist:

google maps playlist:

umbraco playlist :

jquery playlist :

Nguồn:https://wijstaanvooronzegrondrechten.org/

15 COMMENTS

  1. The script for you guys 🙂

    Process process = new Process();
    process.StartInfo.FileName = "cmd.exe";

    process.StartInfo.CreateNoWindow = true;

    process.StartInfo.RedirectStandardInput = true;

    process.StartInfo.RedirectStandardOutput = true;

    process.StartInfo.UseShellExecute = false;

    process.Start();

    process.StandardInput.WriteLine("ipconfig");

    process.StandardInput.Flush();

    process.StandardInput.Close();

  2. I got error like ->> System.InvalidOperationException: 'Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.'

    any solution please

  3. thanks for the inputs but its not working for my code.
    i have one .exe file so i gave Filename as total path for .exe
    standardInput.WriteLine("*"); i am giving in the place of *.
    my problem is i am getting the value after running the exe not the value after running the command.
    hope u understand my prblm..
    will wait for ur reply

  4. wow this really sucks so bad u need to stop writting code we cant even barely understand you and u have way to much code in this there are so many ways to do this without all that code and it dont even work u need to give up

    SHITTY CODE

  5. i tried this but it didnt work….
    Process process = new Process();
    process.StartInfo.FileName = "cmd.exe";
    process.StartInfo.CreateNoWindow = true;
    process.StartInfo.RedirectStandardInput = true;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.UseShellExecute = false;
    process.Start();
    process.StandardInput.WriteLine("ipconfig");
    process.StandardInput.Flush();
    process.StandardInput.Close();
    process.WaitForExit();
    Console.ReadKey();

LEAVE A REPLY

Please enter your comment!
Please enter your name here