On 20 Jan 2007 14:50:24 -0800, "totleben" <mu******@gmail.comwrote:
>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