如何在 Windows 上打开 URL 列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5668696/
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
How can I open a list of URLs on Windows
提问by jrdmcgr
I'm looking for a way to open a list of URLs in all of my browsers ( Firefox, Chrome, and IE ) on Windows using a scriptable shell such as Powershell or Cygwin.
我正在寻找一种方法来使用可编写脚本的 shell(例如 Powershell 或 Cygwin)在 Windows 上的所有浏览器(Firefox、Chrome 和 IE)中打开 URL 列表。
Ideally I should be able to type in a list of URLs as arguments to the command, i.e. `openUrl http://example.nethttp://example2.nethttp://example3.com...
理想情况下,我应该能够输入 URL 列表作为命令的参数,即 `openUrl http://example.net http://example2.net http://example3.com...
I would also need this script to pass authentication info into the http header (encoded usename and password).
我还需要此脚本将身份验证信息传递到 http 标头(编码的用户名和密码)。
回答by Scott Weinstein
With chrome it's not hard.
使用 chrome 并不难。
$chrome = (gi ~\AppData\Local\Google\Chrome\Application\chrome.exe ).FullName
$urls = "stackoverflow.com","slate.com"
$urls | % { & $chrome $_ }
回答by Yi Zhao
First, how to open URLs in PowerShell. In PowerShell open a URL is very simple, just use start
首先,如何在 PowerShell 中打开 URL。在PowerShell中打开一个URL很简单,使用start
start http://your.url.com
I think you can simple use foreach
to handle the list of URLs.
我认为您可以简单地使用foreach
来处理 URL 列表。
Second, pass authentication via URL. There is a standard way for HTTP based authentication. (not HTML form based). You could construct the URL like:
其次,通过 URL 进行身份验证。有一种基于 HTTP 的身份验证的标准方法。(不是基于 HTML 表单的)。您可以构建如下 URL:
http://username:[email protected]
Again, it only works for HTTP based authentication.
同样,它仅适用于基于 HTTP 的身份验证。
回答by data
Look at HKCR\http\shell\open\command
how each browser handles urls. Then just use the normal methods to launch the browsers with appropriate urls.
看看HKCR\http\shell\open\command
每个浏览器是如何处理 url 的。然后只需使用常规方法启动具有适当 url 的浏览器。