如何检查浏览器窗口是否按标题批量打开? [英] How to check if explorer window is open by title in batch?

查看:74
本文介绍了如何检查浏览器窗口是否按标题批量打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查资源管理器是否已打开?

How do I check if an explorer is open or not in batch?

我需要对目录进行截图,并选择一个文件,但是仅在窗口打开之后.窗口标题始终相同.

I need to take a screenshot of the directory with a file selected, but only after the window has opened. The window title is always the same.

谢谢

示例:

REM Opening folder with a file selected
START /W EXPLORER /SELECT,\\10.10.10.10\C$\ThisFolder\FileToHighlight.txt
REM Unreliably waiting for window to open
TIMEOUT /T 3 /NOBREAK >NUL
REM Taking screenshot of window with a third-party app
START .\Bin\screenshot-cmd.exe -wt "ThisFolder" -o .\Screenshots\%var%.png

推荐答案

提供的其他窗口与打开的文件夹具有相同的标题,您可以使用

Provided there can be no other window with the same title as the opened folder you can use tasklist:

@echo off
rem DON'T ADD A TRAILING \ IN THE PATH!
set folder=d:\path\foldername
explorer "%folder%"
:wait
    timeout 1 >nul
    for %%z in ("%folder%") do (
        tasklist /fi "windowtitle eq %%~nxz" /fi "imagename eq explorer.exe" ^
        | find "explorer.exe" >nul
        if errorlevel 1 goto wait
    )
pause

这篇关于如何检查浏览器窗口是否按标题批量打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆