【DOS BAT】批量打开网页---通过脚本控制不同浏览器批量打开网页

编程知识 更新时间:2023-04-22 10:30:08

在Windows下使用bat脚本批量打开网页,记录一下实现过程。

使用同一个浏览器有两种方式:
方式1是通过浏览器名直接打开该浏览器;
方式2是通过浏览器的绝对路径打开该浏览器。

当使用绝对路径时需要注意的问题:
1、如果该绝对路径中没有空格,没有中文字符,则可以直接使用该路径。例子:正文目录中的1.2.1和1.5.1。
2、如果包含中文字符,则需在bat第一行加入chcp 65001,才能成功打开该路径。例子:正文目录中的1.4.2。
3、如果包含空格,则需要加引号。例子:正文目录中的1.1.2和1.3.2。

文章目录

  • 一、使用不同浏览器批量打开网址
    • 1.1 使用Edge批量打开网页
      • 1.1.1 方式1:使用浏览器名字microsoftedge
      • 1.1.2 方式2:使用Edge浏览器绝对路径(带空格)
    • 1.2 使用谷歌浏览器批量打开网址
      • 1.2.1 使用谷歌浏览器绝对路径打开(不带中文、不带空格)
    • 1.3 使用ie浏览器批量打开网址
      • 1.3.1 方式1:直接使用浏览器名字iexplore
      • 1.3.2 方式2:使用ie浏览器的绝对路径(带空格)
    • 1.4 使用火狐浏览器批量打开网址
      • 1.4.1 方式1:直接使用浏览器名字firefox
      • 1.4.2 方式2:使用浏览器绝对路径(带中文字符)
    • 1.5 使用搜狗浏览器批量打开网页
      • 1.5.1 使用搜狗浏览器的绝对路径(不带中文、不带空格)
  • 二、循环批量打开网页、关闭网页

一、使用不同浏览器批量打开网址

1.1 使用Edge批量打开网页

1.1.1 方式1:使用浏览器名字microsoftedge

首先新建一个txt文件,改名为open_edge.bat,右键 -> 编辑。
将以下命令复制进去:

@echo off
title open web 
timeout /nobreak /t 5
start microsoftedge "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start microsoftedge "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start microsoftedge "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start microsoftedge "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start microsoftedge "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo open web Number is 5
Echo.
timeout /nobreak /t 30

保存,退出,双击运行即可。
代码解释:
timeout /nobreak /t 5代表5秒后打开下一个,根据配置和网络延迟,自己修改。
注意,该值不要设置的太小,否则容易打开漏网页。

1.1.2 方式2:使用Edge浏览器绝对路径(带空格)

@echo off
title open web 
timeout /nobreak /t 5
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo open web Number is 5
Echo.
timeout /nobreak /t 30

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"是我Edge浏览器的绝对路径,因为该浏览器默认装在C盘下,绝对路径(Program Files (x86))中带着空格,所以必须加双引号。

1.2 使用谷歌浏览器批量打开网址

1.2.1 使用谷歌浏览器绝对路径打开(不带中文、不带空格)

首先新建一个txt文件,改名为open_chrome.bat,右键 -> 编辑。
将以下命令复制进去:

@echo off
title 打开网页 
timeout /nobreak /t 10
start C:\Users\anchenliang\AppData\Local\Google\Chrome\Application\chrome.exe "https://blog.csdn/AnChenliang_1002/article/details/123583335"
timeout /nobreak /t 10
start C:\Users\anchenliang\AppData\Local\Google\Chrome\Application\chrome.exe "https://blog.csdn/AnChenliang_1002/article/details/109454465"
timeout /nobreak /t 10
start C:\Users\anchenliang\AppData\Local\Google\Chrome\Application\chrome.exe "https://blog.csdn/AnChenliang_1002/article/details/123708355"
timeout /nobreak /t 10
start C:\Users\anchenliang\AppData\Local\Google\Chrome\Application\chrome.exe "https://blog.csdn/AnChenliang_1002/article/details/110391085"
timeout /nobreak /t 10
start C:\Users\anchenliang\AppData\Local\Google\Chrome\Application\chrome.exe "https://blog.csdn/AnChenliang_1002/article/details/109535355#comments_19244568"


Echo.
Echo ##5个页面,请确认数量##
Echo.
timeout /nobreak /t 10

保存,退出,双击运行即可。
代码解释:
timeout /nobreak /t 5代表5秒后打开下一个,根据配置和网络延迟,自己修改。
注意,该值不要设置的太小,否则容易打开漏网页。

注意事项:
1、C:\Users\anchenliang\AppData\Local\Google\Chrome\Application\chrome.exe为我安装谷歌浏览器的绝对路径
2、该绝对路径中没有中文没有空格,所以可以直接使用该路径;否则的话,就得加引号了。

1.3 使用ie浏览器批量打开网址

1.3.1 方式1:直接使用浏览器名字iexplore

首先新建一个txt文件,改名为open_ie.bat,右键 -> 编辑。
将以下命令复制进去:

@echo off
title open web 
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo ##5个页面,请确认数量##
Echo.
timeout /nobreak /t 30


保存,退出,双击运行即可。
代码解释:
timeout /nobreak /t 5代表5秒后打开下一个,根据配置和网络延迟,自己修改。
注意,该值不要设置的太小,否则容易打开漏网页。

1.3.2 方式2:使用ie浏览器的绝对路径(带空格)

@echo off
title open web 
timeout /nobreak /t 5 

start "" "C:\Program Files\Internet Explorer\iexplore.exe" "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start "" "C:\Program Files\Internet Explorer\iexplore.exe" "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start "" "C:\Program Files\Internet Explorer\iexplore.exe" "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start "" "C:\Program Files\Internet Explorer\iexplore.exe" "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start "" "C:\Program Files\Internet Explorer\iexplore.exe" "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo open web Number is 5
Echo.
timeout /nobreak /t 30

"C:\Program Files\Internet Explorer\iexplore.exe"是我ie浏览器的绝对路径,因为该浏览器默认装在C盘下,绝对路径(Program Files (x86))中带着空格,所以必须加双引号。

1.4 使用火狐浏览器批量打开网址

1.4.1 方式1:直接使用浏览器名字firefox

首先新建一个txt文件,改名为open_fire.bat,右键 -> 编辑。
将以下命令复制进去:
方式1:直接使用firefox

@echo off
title open web 
timeout /nobreak /t 5
start firefox "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start firefox "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start firefox "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start firefox "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start firefox "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo ##5个页面,请确认数量##
Echo.
timeout /nobreak /t 30

保存,退出,双击运行即可。
代码解释:
timeout /nobreak /t 5代表5秒后打开下一个,根据配置和网络延迟,自己修改。
注意,该值不要设置的太小,否则容易打开漏网页。

1.4.2 方式2:使用浏览器绝对路径(带中文字符)

chcp 65001
@echo off
title open web 
timeout /nobreak /t 5
start D:\安装的软件\firefox.exe "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start D:\安装的软件\firefox.exe "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start D:\安装的软件\firefox.exe "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start D:\安装的软件\firefox.exe "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start D:\安装的软件\firefox.exe "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo ##5个页面,请确认数量##
Echo.
timeout /nobreak /t 30

1.5 使用搜狗浏览器批量打开网页

1.5.1 使用搜狗浏览器的绝对路径(不带中文、不带空格)

首先新建一个txt文件,改名为open_sougou.bat,右键 -> 编辑。
将以下命令复制进去:

@echo off
title open web 
timeout /nobreak /t 5
start D:\sougou\SogouExplorer\SogouExplorer.exe "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start D:\sougou\SogouExplorer\SogouExplorer.exe "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start D:\sougou\SogouExplorer\SogouExplorer.exe "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start D:\sougou\SogouExplorer\SogouExplorer.exe "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start D:\sougou\SogouExplorer\SogouExplorer.exe "https://blog.csdn/AnChenliang_1002/article/details/115705732"

Echo.
Echo ##5个页面,请确认数量##
Echo.
timeout /nobreak /t 30

保存,退出,双击运行即可。
代码解释:
timeout /nobreak /t 5代表5秒后打开下一个,根据配置和网络延迟,自己修改。
注意,该值不要设置的太小,否则容易打开漏网页。

注意事项:
1、D:\sougou\SogouExplorer\SogouExplorer.exe为我安装搜狗浏览器的绝对路径
2、该绝对路径中不能有中文,不能有空格,否则windows回找不到该exe文件。

二、循环批量打开网页、关闭网页

本文以IE浏览器为例,如果需要使用其他浏览器,参考上面的内容,把下面代码中的iexplore改为其他浏览器名字或绝对路径即可。

@echo off
title open web 

:acl
echo.
echo ## 即将批量打开的网页 ##
echo .
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/109776186"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/116646985"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/115661773"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/115675447"
timeout /nobreak /t 5
start iexplore "https://blog.csdn/AnChenliang_1002/article/details/115705732"

echo ## 即将批量关闭已打开的网页,并再次循环打开 ##
timeout /nobreak /t 30
taskkill /f /im iexplore.exe
goto acl

::pause
exit

代码解释:
timeout /nobreak /t 5代表5秒后打开下一个,根据配置和网络延迟,自己修改。
注意,该值不要设置的太小,否则容易打开漏网页
taskkill /f /im iexplore.exe代表结束批量关闭ie浏览器,当然,ie中打开的网页也被批量关闭了。

更多推荐

【DOS BAT】批量打开网页---通过脚本控制不同浏览器批量打开网页

本文发布于:2023-04-17 02:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/4fc0036364fa912e2ac0db977f1104b0.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:批量   打开网页   脚本   浏览器   DOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 82100文章数
  • 6616阅读数
  • 0评论数