【发布时间】:2022-02-04 01:32:30
【问题描述】:
我需要在一台有 2 个屏幕的 PC 上全屏启动两个 Google 页面,每个屏幕一个页面。
其实这是我的代码:
$pathToChrome = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
$tempFolder = '--user-data-dir=c:\temp' # pick a temp folder for user data
$startmode = '--start-fullscreen' # '--kiosk' is another option
$startPage1 = 'https://google.com'
$startPage2 = 'https://google.com'
Start-Process -FilePath $pathToChrome ('--new-window', '--start-fullscreen', $startPage1) -ErrorVariable Test
Start-Process -FilePath $pathToChrome ('--new-window', '--start-fullscreen', $startPage2) -ErrorVariable Test
它可以工作,但它打开一页而不是另一页。 如何在第二个屏幕上打开第二个页面?
【问题讨论】:
-
已经看到了,但我认为有一种简单的方法可以做到这一点,我知道你可以检查你连接了多少个屏幕:[System.Windows.Forms.Screen]: :allscreens.length 。也许可以使用 for 循环在每个屏幕上启动页面
-
在应用程序启动之前设置这个的唯一方法(至少我知道)是1)将
STARTUPINFOstructure中的坐标传递给@ 987654324@ [...] -
[...] 或 2) 将
SHELLEXECUTEINFOstructure 中的HMONITOR句柄传递给ShellExecuteEx。 - 虽然这两个东西都没有暴露在 PowerShell 中,但您需要为它们使用更多的 P/Invoke 魔法。
标签: powershell window launch