在新窗口中从命令行打开 Windows 中的 chrome

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23160472/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 11:31:26  来源:igfitidea点击:

Open chrome in windows from the command line in a new window

windowsgoogle-chromecmd

提问by ciso

I tried this command from the cmd prompt:

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

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

and I get "windows can not find '--new-window'

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

If I remove the start command, it works fine. If I leave the start command but remove the --new-window parm then the url is opened in my default browser (ie).

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

I've tried several variations of the above but can't get it to work.

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

What is the correct syntax for the start command to open chrome with the given url in a new window?

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

回答by QuickFix

Answer is there : Using the "start" command with parameters passed to the started program

答案是:使用带有传递给启动程序的参数的“start”命令

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

(add empty title parameter at the beginning of the line)

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

回答by Rushabh Agarwal

In Windows 10, following command works:

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

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

This works perfectly in cmd.

这在 cmd 中完美运行。

回答by Brian P

Try to put this in a batchfile, then you can play with size and position to:

尝试将其放入批处理文件中,然后您可以使用大小和位置进行播放:

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"