首页 > 解决方案 > Windows 批量回显倒计时

问题描述

我有一个带有 for 循环的脚本,但我想更改回显行,以便它包含剩余的重试次数。

以下是我的最新尝试,但我无法显示重试次数:

rem Will loop 20 times with 30 second intervals (Total 10 minutes) to confirm deletion. Loop will exit after 20 attempts and move on if dll cannot be deleted.
for /l %%i in (1,1,20) do (
set /a "count=20-=%%i"
del /f /q "%Folder2Del%file*.dll" >nul
if not exist "%Folder2Del%file*.dll" goto Folder2Del
echo/
echo File locked! Will try to delete %count% more times before exit.
timeout /t 30 >nul
)

我已经搜索并尝试应用许多示例,但我无法让它发挥作用。我不知道如何正确设置我的“计数”变量。

标签: batch-filefor-loopvariablescountcommand

解决方案


推荐阅读