遠端桌面連線 執行檔位於 C:\Windows\System32\mstsc.exe,支援多種命令列參數:
| 參數 | 說明 | 範例 |
|---|---|---|
| /v:<server[:port]> | 指定遠端電腦名稱或 IP,可加連接埠 (預設 3389) | mstsc /v:192.168.1.100:3390 |
| /admin 或 /console | 連線到主控台工作階段 (Server 版適用,Win 10/11 Pro 通常忽略) | mstsc /admin /v:server01 |
| /f | 全螢幕模式啟動 | mstsc /f /v:192.168.1.50 |
| /w:<width> /h:<height> | 指定視窗寬高 | mstsc /w:1920 /h:1080 /v:pc-name |
| /public | 公用模式:不快取密碼/位圖/紅導向資訊 (網咖/共用電腦適用) | mstsc /public /v:server |
| /span | 跨多顯示器 (需同解析度) | mstsc /span /v:server |
| /multimon | 使用多顯示器模式 (Win 7/Server 2008 R2+) | mstsc /multimon /v:server |
| /edit <.rdp> | 編輯現有 .rdp 連線檔 | mstsc /edit "MyServer.rdp" |
| /migrate | 遷移舊版 .rdp 檔案設定 | mstsc /migrate |
mstsc → Entermstsc 及參數mstsc.exe → 命名「遠端桌面」C:\Windows\System32 → Entermstsc.exe (或 mstsc)%SystemRoot%\System32\mstsc.exe (或 C:\Windows\System32\mstsc.exe)$ws = New-Object -ComObject WScript.Shell
$shortcut = $ws.CreateShortcut("$env:USERPROFILE\Desktop\遠端桌面連線.lnk")
$shortcut.TargetPath = "C:\Windows\System32\mstsc.exe"
$shortcut.Description = "Windows 遠端桌面連線"
$shortcut.Save()
另存連線設定為 MyConnection.rdp,用記事本編輯關鍵參數:
screen mode id:i:2 ; 2=全螢幕, 1=視窗
desktopwidth:i:1920
desktopheight:i:1080
session bpp:i:32 ; 色深 32-bit
audiocapturemode:i:0 ; 0=不重導向音訊輸入, 1=重導向
audiomode:i:0 ; 0=在遠端播放, 1=在本地播放, 2=不播放
redirectprinters:i:1 ; 重導向印表機
redirectdrives:i:1 ; 重導向磁碟機 (共享本地磁碟)
redirectclipboard:i:1 ; 共用剪貼簿
redirectsmartcards:i:1 ; 重導向智慧卡
authentication level:i:2 ; 2=要求網路層級驗證 (NLA), 建議保持
enablecredsspsupport:i:1 ; 支援 CredSSP
gatewayusagemethod:i:0 ; 0=不使用閘道, 1=總是使用, 2=僅直接連線失敗時使用
gatewayhostname:s:rdg.example.com
gatewayusername:s:domain\user
gatewaypassword:s:******** ; 不建議明文存密碼
prompt for credentials:i:1 ; 1=每次提示憑證, 0=使用儲存憑證
enablecredsspsupport:i:0 (降低安全性)rdpclip.exe 進程正常 (可重啟);群組原則未停用裝置重導向