【问题标题】:Open chrome in windows from the command line in a new window在新窗口中从命令行打开 chrome in windows
【发布时间】:2014-06-03 08:06:55
【问题描述】:

我在 cmd 提示符下尝试了这个命令:

start "c:\program files (x86)\google\chrome\application\chrome.exe" --new-window "http://localhost:8080:/debug?port=5858"

我得到“windows 找不到 '--new-window'

如果我删除启动命令,它工作正常。如果我离开启动命令但删除 --new-window 参数,则 url 将在我的默认浏览器中打开(即)。

我已经尝试了上述的几种变体,但无法正常工作。

在新窗口中使用给定 url 打开 chrome 的 start 命令的正确语法是什么?

【问题讨论】:

  • 对于任何来这里寻求答案的人,我建议也看看this问题。

标签: windows google-chrome cmd


【解决方案1】:

那里有答案:Using the "start" command with parameters passed to the started program

start "" "c:\program files (x86)\google\chrome\application\chrome.exe" --new-window "http://localhost:8080:/debug?port=5858"

(在行首添加空标题参数)

【讨论】:

  • 有没有办法可以从 c# 程序中执行这段代码?我尝试了 ProcessStartInfo 类,但没有成功
【解决方案2】:

在 Windows 10 中,以下命令有效:

start chrome --new-window "https://www.facebook.com"

这在 cmd 中完美运行。

【讨论】:

    【解决方案3】:

    试着把它放在一个批处理文件中,然后你可以用大小和位置来玩:

    start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "http://brianp.dk/" --window-size="2560,1000" --window-position="0,0" --user-data-dir="D:/Test/Profiles/1"
    start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "http://borsen.dk/" --start-maximized --window-position="2560,000" --user-data-dir="D:/Test/Profiles/2"
    start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "http://penge.dk/" --window-size="1280,1000" --window-position="0000,1000" --user-data-dir="D:/Test/Profiles/3"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-30
      • 2011-09-30
      • 1970-01-01
      • 2017-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多