C#转接远程桌面直接传入用户名和密码
void Main() { var ip = "192.168.0.x"; var username = "administrator"; var password = "123456"; Process rdcProcess = new Process(); rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\cmdkey.exe"); rdcProcess.StartInfo.Arguments = string.Format( "/generic:TERMSRV/{0} /user:{1} /pass:{2}",ip,username,password); rdcProcess.Start(); rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe"); rdcProcess.StartInfo.Arguments = "/v " + ip; // ip or name of computer to connect rdcProcess.Start(); }
桂棹兮兰桨,击空明兮溯流光。