windows 从命令行打开 Chrome

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14348840/
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 10:11:45  来源:igfitidea点击:

Opening Chrome From Command Line

windowsgoogle-chromebatch-filecommand-prompt

提问by user1473784

I have the following batch file:

我有以下批处理文件:

@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"

But when I run it, it causes the prompt to hang and renders it unusable until Chrome is closed. (Or, if I am not using the prompt and run it from the icon, it opens a blank prompt that is unusable and disappears when Chrome is closed.)

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

Is there any way to prevent this? I.E. once the webpages are open, the prompt is no longer tied up.

有什么办法可以防止这种情况吗?IE一旦打开网页,提示不再被束缚。

It opens the webpages just fine. I've also noticed that if there's already a chrome window open, the batch runs fine (leaving a usable prompt), adding the tabs to the existing chrome session.

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

回答by GavinH

Have a look into the startcommand. It should do what you're trying to achieve.

看看start命令。它应该做你想要实现的目标。

Also, you might be able to leave out path to chrome. The following works on Windows 7:

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

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

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

回答by wiseindy

Use the start command as follows.

使用启动命令如下。

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

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

It will be better to close chrome instances before you open a new one. You can do that as follows:

在打开一个新实例之前,最好先关闭 chrome 实例。你可以这样做:

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

That'll work for you.

这对你有用。

回答by guest

C:\>start chrome "http://site1.com"works on Windows Vista.

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

回答by CBU

Let's take a look at the startcommand.

我们来看看start命令。

Open Windows command prompt

打开 Windows 命令提示符

To open a new Chrome window (blank), type the following:

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

start chrome --new-window 

or

或者

start chrome

To open a URL in Chrome, type the following:

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

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

To open a URL in Chrome in incognito mode, type the following:

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

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

or

或者

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

回答by BERGUIGA Mohamed Amine

you can create batch file and insert into it the bellow line:

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

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

after that you do just double click on this batch file.

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

回答by riyaanmohd

open command prompt and type

打开命令提示符并键入

cd\ (enter)

then type

然后输入

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