detect whether web browser is open or close using batch file

孤街浪徒 提交于 2021-02-08 05:43:45

问题


I would like to access my web browser using a batch file.Is there a way of knowing whether any web browser is open or not using a batch file? Take any browser for example.


回答1:


Yes, there is a way. The command tasklist returns you a list of running tasks:

@ECHO OFF
SET running=0
FOR /f "tokens=*" %%A IN ('tasklist^ /v^| findstr /i /c:"firefox32.exe"') DO SET running=1
IF %running%==1 ECHO Firefox is running!
PAUSE

This checks whether Firefox is running.



来源:https://stackoverflow.com/questions/29673466/detect-whether-web-browser-is-open-or-close-using-batch-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!