Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

smilethat

@smilethat
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • process
    S smilethat

    you can start process using c# by this way: using System.Diagnostics ....... Process.Start("notepad.exe"); ....... Process.Start("cmd",@"/c mysqldump --user=root --password=123 mysql > c:\db.sql -t");//useful ....... Process.Start("notepad.exe","c:\\record.txt"); ....... Process.Start("IEXPLORE.EXE","http://jnjx.126.com"); ....... Process.Start(@"C:\myFiles\MyApp.exe"); ..... and you can stop the process usingC# by this way: //you can use the function using System.Diagnostics; .......... private void KillProcess(string processName) { Process myproc= new Process(); // try { foreach(Process thisproc in Process.GetProcessesByName(processName)) { thisproc.Kill(); } } catch(Exception Exc) { MessageBox.Show(Exc.Message); } } //you can call this function like :KillProcess("iexplore.exe");

    C# csharp tutorial

  • getting result from the cmd prompt
    S smilethat

    you can do it like that: Process p = new Process(); //Fill the StartInfo of the Process----"cmd.exe" p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true;//important p.StartInfo.RedirectStandardOutput = true;//important p.StartInfo.RedirectStandardError = false;//true,the same... p.StartInfo.CreateNoWindow = true;//important string strResult; p.Start();//start the process //for example p.StandardInput.WriteLine("ping www.google.com "); p.StandardInput.WriteLine("exit");//important strResult= p.StandardOutput.ReadToEnd(); // below...you want if (strResult.IndexOf("( 0% loss )") != -1) { } else if (strResult.IndexOf("Destination host unreachable.") != -1) { } else if (strResult.IndexOf("Request timed out.") != -1) { } else if (strResult.IndexOf("Unknown host") != -1) { } else { } // if end p.Close();//close the process

    C# csharp
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups