需要以全屏方式启动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进程,但是不知道为什么界面没有显示。网上有人说这个参数已经失效,新版本不支持。