需要以全屏方式啓動Chrome,存在多屏幕的可能,每個屏幕都以全屏方式在不同窗體顯示不同頁面。
Chrome部分參數說明:
--window-position 窗體位置(X,Y)
--user-data-dir 用戶數據保存路徑,確保不同Chrome程序使用不同的路徑,否則所有的Chrome程序的窗體位置和大小會與第一個保持一致
--disable-gpu 禁用GPU加速,可根據實際情況選擇是否開啓。開啓時,有可能閃現黑屏。
--kiosk 全屏模式
--disable-desktop-notifications 禁止桌面通知
--no-first-run 非首次運行(避免一些首次運行提示)
--disable-popup-blocking 禁用阻止彈窗
--no-default-browser-check 禁用默認瀏覽器檢查
--incognito 匿名模式(啓動時不會有緩存問題)
@echo off
cd /d %~dp0
title Chrome
tasklist|find /i "chrome.exe" ||goto startRun
taskkill /im chrome.exe /f
goto startRun
:startRun
@set frontPageUrl=http://www.baidu.com
@set frontPagePositionX=0
@set frontPagePositionY=0
@set backgroundPageUrl=http://www.bing.com
@set backgroundPagePositionX=1024
@set backgroundPagePositionY=0
start chrome.exe %frontPageUrl% --window-position=%frontPagePositionX%,%frontPagePositionY% --user-data-dir="C:/temp/Chrome/1" --disable-gpu --kiosk --disable-desktop-notifications --no-first-run --disable-popup-blocking --no-default-browser-check --incognito
start chrome.exe %backgroundPageUrl% --window-position=%backgroundPagePositionX%,%backgroundPagePositionY% --user-data-dir="C:/temp/Chrome/2" --disable-gpu --kiosk --disable-desktop-notifications --no-first-run --disable-popup-blocking --no-default-browser-check --incognito
:end
運行後會以全屏方式顯示百度和必應頁面,如果存在多屏且主屏分辨率是1024*768,則必應頁面顯示在第二個界面(如果調整了多屏設置,可能顯示的會不一樣)。
關鍵參數:
user-data-dir,啓動多個Chrome時如果沒有此參數或者參數值一樣,Chrome會將多個頁面以多標籤的方式放在一個窗體裏。
kiosk,全屏顯示,適合自助終端顯示頁面(高版本Chrome好像已經屏蔽了右鍵和F12)
除了kiosk模式外,Chrome還有一個應用模式,參數是“--app”。例如
start chrome.exe --app=http://www.baidu.com
完整參數可以查看:https://peter.sh/experiments/chromium-command-line-switches/
關於全屏效果已經在XP(Chrome 35)、Win7、Win10上測試。
不知道誰可以解答下“--single-process”參數,加上這個參數後,只有一個Chrome進程,但是不知道爲什麼界面沒有顯示。網上有人說這個參數已經失效,新版本不支持。