我想在這部分"if exist "%%d:\%folder%\" (echo Device was found on %%d:)"
這段代碼添加另一條指令,所以如果該文件夾被發現,它也會做set folderfound="%%d:\%folder%\"
是否有可能做這樣的事情? 這是完全的代碼顯示什麼即時試圖做批處理,如果存在錯誤
:autodetect1
set /p "folder=Folders Name that the photo's are in: "
setlocal
set folder=%1
if "%folder%" == "" call :autodetect1
cls
for %%d in (d e f g h i j k l m n o p q r s t u v w x y z) do (
if exist "%%d:\%folder%\" (
echo Device was found on %%d: and set folderfound=%%d:\%folder%\
) else (
echo Device was not found on %%d:
)
)
我讀的論壇上,我發現一提的是,你可以使用& &執行其他命令後直是否存在可我用這裏面的?
看起來好像「轉到EOF」應爲「GOTO:EOF」 - 但是,使腳本在詢問文件夾名稱後立即終止。不知道你想做什麼... –