Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 用于打开多个url的Powershell脚本';ie浏览器中的s_Windows_Powershell_Internet Explorer - Fatal编程技术网

Windows 用于打开多个url的Powershell脚本';ie浏览器中的s

Windows 用于打开多个url的Powershell脚本';ie浏览器中的s,windows,powershell,internet-explorer,Windows,Powershell,Internet Explorer,试图通过powershell脚本在ie浏览器中打开多个url 目前我的代码在chrome浏览器中运行,如何在ie浏览器中实现同样的功能 $urls=gc "C:actual path of the url folder\url.txt" foreach($url in $urls){ start-process chrome.exe $url } 有人能帮我吗?你可以用iexplore在代码中用“chrome.exe”替换这个部件,它应该可以工作 编辑: 由于原始解决方案在多个窗口

试图通过powershell脚本在ie浏览器中打开多个url

目前我的代码在chrome浏览器中运行,如何在ie浏览器中实现同样的功能

$urls=gc "C:actual path of the url folder\url.txt"
foreach($url in $urls){
    start-process chrome.exe $url

}

有人能帮我吗?

你可以用iexplore在代码中用“chrome.exe”替换这个部件,它应该可以工作


编辑: 由于原始解决方案在多个窗口中打开了链接,因此我创建了一个更新的脚本,尝试在同一浏览器窗口中打开所有链接

$IE = new-object -ComObject "InternetExplorer.Application"
$urls= gc "FILEPATH"
$count=1
foreach ($url in $urls){
    if ($count -eq 1){
        $IE.navigate($url,1)
    }
    else{
        $IE.navigate($url,2048)
    }
    $count++
}

我认为这可以帮助你:

下一个代码将使用默认web浏览器打开:

$urls = @("https://stackoverflow.com/","https://www.google.com/","https://www.thomasmaurer.ch/2017/02/open-website-from-powershell/")

foreach($url in $urls){
    Start-Process $url
}
下一步将在iexplorer中打开:

$urls = @("https://stackoverflow.com/","https://www.google.com/","https://www.thomasmaurer.ch/2017/02/open-website-from-powershell/")

foreach($url in $urls){
    # Start-Process "C:\Program Files (x86)\Internet Explorer\iexplore.exe" $url
    Start-Process iexplore.exe $url
}
看看Those链接:

**

  • 在InternetExplorer上编辑多个选项卡:
** 注意:在Internet Explorer中,启动过程不会将新Url(在“新建”选项卡上)添加到现有IE实例。 如果您想在IExplorer上打开同一实例中的所有URL,您必须尝试其他代码,并查看以下文章:


它可以工作,但我有两个观察:1.它不是像chrome那样在单一浏览器中打开的。2.它并没有打开所有的门urls@AbhilashPoojary你可以看看这篇文章,在InterExplorer@AbhilashPoojary中打开url,我想我可能已经找到了在单个浏览器窗口中打开链接的方法。请看我所做的编辑。@telsub感谢您根据我的要求对其进行了修改。@crapyprog这太棒了。我们遇到多个站点间歇性抛出500个错误,因此我能够创建一个脚本,在一次快照中打开多个站点。我仍然需要浏览每个浏览器标签,看看网站是否正确打开。有没有办法让PowerShell在其中一个选项卡抛出500错误时告诉我?