poor

导航

C#连接远程windows桌面

   /// <summary>
        /// 连接远程windows桌面
        /// </summary>
        /// <param name="ip"></param>
        private void ConnectRemotely(string ip)
        {
            string command = "mstsc /v: "+ip+" /console";
            Process p = new Process();
            p.StartInfo.FileName = "cmd.exe";
            p.StartInfo.Arguments = "/c"+command;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = true;
            p.Start();


        }

posted on 2010-11-18 21:12  彼岸灯塔  阅读(197)  评论(0)    收藏  举报