我的脚本的这一部分应该通过目录查找* .wim文件,如果它在"图像"上找到它们。文件夹,继续。然而,它直接进入"否则"部分代码:/
ECHO. Checking for WIMs
ECHO ............................................
ECHO.
for /F "tokens=*" %%f in ('dir /B /S "%w%:\data\images"') do (
if exist "%%~ff\*.wim" (
ECHO found me some wims! let's continue.
GOTO actionmenu
) else (
ECHO This script requires a wim repository folder to proceed. make sure you have
ECHO properly populated the "\Images" folder before re-running this script
goto end
)
)
答案 0 :(得分:0)
setTimeout( reset_slider(), 3000)
答案 1 :(得分:0)
您甚至不需要for
循环。 Dir
会%errorlevel%
1
,如果找不到的话:
dir /B /S "%w%:\data\images\*.wim" >nul && (
echo found at least one wim file.
) || (
echo no wim files found.
)
&&
作为“如果上一个命令成功(dir
找到至少一个文件),那么”
||
正好相反:“如果上一个命令失败(dir
找不到匹配的文件),那么”