如何让Chrome自动启动网页并以全屏模式打开?

Q: 如何让Chrome自动启动网页并以全屏模式打开?

A:

  • 启动代码startup.bat

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    @echo off
    cd /d C:\AutoStart

    REM 第一步:启动 Chrome 打开网页
    start "" "C:\Program Files\Google\Chrome\Application\chrome.exe" --new-window "https://heiok.com/"

    REM 等待 5 秒让网页加载
    timeout /t 5 /nobreak > nul

    REM 第二步:打开图片(全屏)
    start "" "C:\Program Files\IrfanView\i_view64.exe" "%USERPROFILE%\Desktop\2.png" /fs

    REM 等待 3 秒确保图片已全屏
    timeout /t 3 /nobreak > nul

    REM 第三步:再次激活网页窗口 → 刷新 → 全屏
    powershell -ExecutionPolicy Bypass -File "send_f11.ps1
  • 按键代码send_f11.ps1

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    Start-Sleep -Seconds 1

    $wshell = New-Object -ComObject wscript.shell

    # 多次尝试激活浏览器窗口
    $success = $false
    for ($i = 0; $i -lt 5; $i++) {
    if ($wshell.AppActivate("网络蝙蝠侠")) {
    $success = $true
    break
    }
    Start-Sleep -Seconds 1
    }

    if ($success) {
    Start-Sleep -Milliseconds 500

    # 连续刷新网页(防止白屏)
    for ($i = 0; $i -lt 2; $i++) {
    $wshell.SendKeys("{F5}")
    Start-Sleep -Seconds 2
    }

    # 最终进入全屏
    Start-Sleep -Seconds 1
    $wshell.SendKeys("{F11}")
    }

  • 设置,按下 Win + R → 输入:shell:startup → 回车,把 startup.bat 放进打开的启动文件夹。