1
我正在使用此批處理循環直到找到文件。有沒有辦法查找多個文件LookForFile= ("D:\File.txt" "D:\File1.txt")
要求找到所有文件,然後結束腳本..使用類似於下面的東西的批處理?批處理腳本以查找多個文件,並保留
SET LookForFile="D:\File.txt"
:CheckForFile
IF EXIST %LookForFile% GOTO FoundIt
REM If we get here, the file is not found.
REM Wait 5 seconds and then recheck.
REM If no display is needed, comment/remove the timeout line.
TIMEOUT /T 5 >nul
GOTO CheckForFile
:FoundIt
REM If you are here the file is found
ECHO Found: %LookForFile%
任何建議將是可愛的感謝。
代碼會在至少找到一個文件或找到所有文件的情況下繼續運行嗎? –
@MCND找到所有文件時。添加到問題。 – JPC
您可以使用命令'Where /?'==> [用單個字符串查找多個文件路徑](http://stackoverflow.com/questions/40048402/find-multiple-files-paths-with-single-string/ 40057656#40057656)將''FileName = Readme.txt''改爲''FileName = File * .txt'' – Hackoo