I use msdos in C# ???

  • Thread starter Thread starter totleben
  • Start date Start date
T

totleben

I want working some msdos command with C#. I want works this codes in
C#. If click buton1 before start cmd after working this code after
close cmd.

How to build this code in C# ?

netsh>pushd

netsh>interface ip

netsh interface ip>set address local static 10.0.0.9 255.0.0.0 10.0.0.1
1

netsh interface ip>popd


Sorry, my english bad :(
 
I want working some msdos command with C#. I want works this codes in
C#. If click buton1 before start cmd after working this code after
close cmd.

How to build this code in C# ?

netsh>pushd

netsh>interface ip

netsh interface ip>set address local static 10.0.0.9 255.0.0.0 10.0.0.1
1

netsh interface ip>popd


Sorry, my english bad :(
Write your MSDOS comands into a batch file. Fire the batch file from
within a C# process.

-- mybatch.bat ----

echo "Hello World!"
pause


-- C# --

using System.Diagnostics;

static void Main() {
using (Process proc = Process.Start("mybatch.bat")) {
proc.WaitForExit();
if (proc.ExitCode == 0) {
Console.WriteLine("Finished OK");
}
}
}

Your English is a lot better than my German (?)

rossum
 
Everyone please note that the Windows command prompt is not MS-DOS.
Correct, however it is the closest that the OP is likely to get this
side of a version of Mono for MSDOS.

rossum
 
Back
Top