C#|启动远程桌面作为进程+在文本框中放置文本

时间:2011-08-10 14:42:43

标签: c#

好吧,这个问题的标题是愚蠢的,但我会非常简单地说明。

在我的代码中,我正在查找远程deskop.exe

像这样:

Process rtc;
    rtc = Process.Start(@"C:\Windows\System32\mstsc.exe");

现在,问题是。当远程桌面出现(其工作)时,我想知道如何在连接的文本框中输入名称。

所以当遥控器启动时,会出现连接名称或ip。

甚至是posibale?

3 个答案:

答案 0 :(得分:4)

mstsc有很多可以传递给它的命令行参数:

MSTSC [<connection file>] [/v:<server[:port]>] [/admin] [/f[ullscreen]] [/w:<width> /h:<height>] [/public] | [/span] [/multimon] [/migrate] [/edit "connection file"]

"connection file" -- Specifies the name of an .RDP file for the connection.

/v:<server[:port]> -- Specifies the remote computer to which you want to connect.

/admin -- Connects you to the session for administering a server.

/f -- Starts Remote Desktop in full-screen mode.

/w:<width> -- Specifies the width of the Remote Desktop window.

/h:<height> -- Specifies the height of the Remote Desktop window.

/public -- Runs Remote Desktop in public mode.

/span -- Matches the remote desktop width and height with the local virtual desktop, spanning across multiple monitors, if necessary. To span across monitors, the monitors must be arranged to form a rectangle.

/multimon -- Configures the remote desktop session monitor layout to be identical to the current client-side configuration.

/edit -- Opens the specified .RDP connection file for editing.

/migrate -- Migrates legacy connection files that were created with Client Connection Manager to new .RDP connection files.

答案 1 :(得分:3)

使用/v参数:

Process.Start("mstsc.exe", string.Format("/v:{0}:{1}", server, port));

答案 2 :(得分:0)

您可以使用参数 -v: mstsc.exe启动<remoteip|remotemachine>以实现相同的目标(用户将提示输入登录凭据)