【问题标题】:Opening Chrome From Command Line从命令行打开 Chrome
【发布时间】:2012-12-30 04:58:12
【问题描述】:

我有以下批处理文件:

@echo off
REM Starts a chrome browser with multiple tabbed sites
C:\Users\UserName\AppData\Local\Google\Chrome\Application\chrome.exe "site1.com" "site2.com"

但是当我运行它时,它会导致提示挂起并使其无法使用,直到 Chrome 关闭。 (或者,如果我没有使用提示并从图标运行它,它会打开一个无法使用的空白提示,并在 Chrome 关闭时消失。)

有什么办法可以防止这种情况发生吗? IE。网页打开后,提示不再绑定。

它可以很好地打开网页。我还注意到,如果已经打开了 chrome 窗口,则批处理运行良好(留下可用提示),将选项卡添加到现有 chrome 会话中。

【问题讨论】:

  • 这将起作用:google-chrome google.com

标签: windows google-chrome batch-file command-prompt


【解决方案1】:

查看start 命令。它应该做你想要达到的目标。

此外,您也许可以省略 chrome 的路径。以下适用于 Windows 7:

start chrome "site1.com" "site2.com"

【讨论】:

  • 如何提供如下参数:google-chrome --enable-webgl --ignore-gpu-blacklist
  • 在 URL 之前包含任何额外的参数。启动 chrome --enable-webgl --ignore-gpu-blacklist "site1.com" "site2.com"
  • 如何使用用户配置文件打开?我有多个 chrome 用户配置文件。 @GavinH
【解决方案2】:

使用启动命令如下。

start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.google.com

最好先关闭 chrome 实例,然后再打开一个新实例。你可以这样做:

taskkill /IM chrome.exe
start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.google.com

这对你有用。

【讨论】:

  • @Vidz 使用start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.google.com
  • @Vidz 谢谢。我也有同样的问题。但是我的默认浏览器是IE(Internet Explorer)。
  • 如何指定端口号?
  • @NilsSens - 您可以像start chrome "http:localhost:88\bar" 一样指定端口号,其中88 是端口号。域和端口之间需要冒号。
【解决方案3】:

C:\>start chrome "http://site1.com" 适用于 Windows Vista。

【讨论】:

  • 一年前给出的已接受答案增加了什么?
【解决方案4】:

我们来看看start命令。

打开 Windows 命令提示符

要打开一个新的 Chrome 窗口(空白),请输入以下内容:

start chrome --new-window 

start chrome

要在 Chrome 中打开 URL,请输入以下内容:

start chrome --new-window "http://www.iot.qa/2018/02/narrowband-iot.html"

要在 Chrome 中以隐身模式打开 URL,请输入以下内容:

start chrome --new-window --incognito "http://www.iot.qa/2018/02/narrowband-iot.html"

start chrome --incognito "http://www.iot.qa/2018/02/narrowband-iot.html"

【讨论】:

    【解决方案5】:

    您可以创建批处理文件并将以下行插入其中:

    cmd /k start chrome "http://yourWebSite.com
    

    之后,您只需双击此批处理文件。

    【讨论】:

      【解决方案6】:

      打开命令提示符并输入

      cd\ (enter)
      

      然后输入

      start chrome "www.google.com"(any website you require)
      

      【讨论】:

        【解决方案7】:

        如果你想打开隐身窗口,请输入以下命令:

        启动 chrome /incognito

        【讨论】:

          【解决方案8】:

          回答此问题供Ubuntu用户参考。

          运行命令google-chrome --app-url "http://localhost/"

          在参数中替换您想要的 URL。

          您可以获得更多选项,例如隐身模式等。 运行 google-chrome --help 以查看选项。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2014-08-15
            • 2014-06-03
            • 1970-01-01
            • 2013-11-08
            • 2018-07-23
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多