Windows命令行下如何使用批处理异步打开一个浏览器进程

Browse.bat

@echo off
if '%1'=='-c' (
    start /d "C:Program FilesGoogleChromeApplication" chrome.exe -new-tab %2
    exit
)
if '%1'=='-f' (
    start /d "C:Program FilesMozilla Firefox" firefox.exe -new-tab %2
    exit
)
if '%1'=='-i' (
    start /d "C:Program FilesInternet Explorer" iexplore.exe %2
    exit
)
if '%1'=='-d' (
    rundll32 url.dll,FileProtocolHandler %2
    exit
)

if '%1'=='-a' (
    call browse -c %2
    call browse -f %2
    call browse -i %2
) else (
    explorer %1
)

上述start /d可以异步启动各浏览器的新Tab,不会导致浏览器卡的进程阻塞整个批处理的继续执行。

"Program Files"在64位的系统下运行32位的IE,就是"C:Program Files (x86)"了,此处可以再考虑用系统环境编码。

之所以会有这个批处理文件的出现:

1.个人开发做前端页面测试,需要兼容三大浏览器,手动打开页面费时间了。

2.工作中测试这些页面的烂事多了,就需要抽象一下了。家具公司组装家具都带电动螺丝刀了,哪还有手工螺丝刀的啊?

原文地址:https://www.cnblogs.com/rgqancy/p/InBatchStartBrowserProcessAsynchronouslyUnderWindowsCommandLine.html