问题
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