MSTSC 在第二台显示器上设置为全屏

MSTSC 在第二台显示器上设置为全屏

我有一台带连接显示器的笔记本电脑,所以我有两个显示器。我想将我的 MSTSC 客户端会话设置为我的辅助显示器的大小 - 但是我经常在办公室之间往返,因此第二个屏幕的大小会发生变化 - 将客户端设置设置为 FULL 会将其设置为我提到的主显示器的大小这里。将我的主显示器交换到所附显示器不会起作用,因为这样所有图标都将被 MSTSC 会话覆盖。

我想要这个,因为当 MSTSC 在第二个屏幕上全屏时,它会捕获特殊键 ALT-TAB 等,但我仍然可以单击主屏幕上的应用程序。目前我有许多不同的已保存 RDP 文件 - 每个可能的分辨率一个。但有时我无法猜出正确的大小。

我可能可以为此编写一个脚本 - 有人这样做过吗?或者甚至编写了一个脚本来确定是否有辅助屏幕以及两个屏幕的分辨率是多少?Powershell 比 VBScript 更好。

这个问题类似于[这个](当客户端显示屏大于主机显示屏时,如何使用 RDMan 与多台显示器并缩放到全屏?)但我想使用 MSTSC,因为我认为 alt-tab 功能不适用于 RDPMan。

谢谢

答案1

最后我找到了几篇文章,并写了以下 Powershell 脚本 - 你给它指定服务器的名称 - 该名称必须是已保存的 RDP 文件

$RDPFile=$Args[0]

Add-Type -AssemblyName System.Windows.Forms
$Screens = [System.Windows.Forms.Screen]::AllScreens 
# Look for a non-primary screen - @todo - what if I have three screens?
$Screen = $Screens | where-object {$_.Primary -eq $FALSE}[0]
# If we dont have a screen which is not a Primary then use the primary    
if ($Screen -eq $Null) { 
  $Screen = $Screens | where-object {$_.Primary -eq $TRUE}[0]
}
# Now connect using an RDP file - but set the width and height and full screen mode
 mstsc.exe E:\cmds\RDP\$($RDPFILE).RDP /f /w:$($Screen.Bounds.Width) /h:$($Screen.Bounds.Height) 

相关内容