代码杂记3-2

C#中下载一个网络上的文件

            string url = "http://60.210.16.252/ifox/TGogoESUTGodTmk9JESuJfmg-LsAJ6Xl4AV-HliuS6PNs91v/SoHuVA_4.0.0.98-byd-b360-c1001-nsi-x.exe";
            WebClient myWebClient = new WebClient();
            myWebClient.DownloadFile(url, @"./down.exe");

执行exe文件

            System.Diagnostics.Process pExecuteEXE = new System.Diagnostics.Process();
            pExecuteEXE.StartInfo.FileName = "down.exe";
            pExecuteEXE.Start();
            pExecuteEXE.WaitForExit();

获取进程名,ID

            List<string> str = new List<string>();
            Process[] processes;
            processes = System.Diagnostics.Process.GetProcesses();
            foreach (Process pro in processes)
            {
                str.Add(pro.ProcessName);
            }
            str.Sort();

 

posted @ 2013-03-02 22:16  大器天下  阅读(153)  评论(0编辑  收藏  举报