@echo off set LOG=%SystemDrive%\SearchAutoconfig.txt set BATCH=StartAutoconfig.cmd if not "%1"=="STDOUT_TO_FILE" %0 STDOUT_TO_FILE %* 1>%LOG% 2>&1 shift /1 echo ####### %0 ####### date /t time /t echo. rem scan for the USB media (infinite) ... :loop for %%D in (A B 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:\%BATCH% ( echo EXECUTING %%D:\%BATCH% ... cd /D %%D:\ start /MIN cmd /C %BATCH% GOTO END ) else ( echo INFO: %BATCH% not found on drive %%D! ) ) echo INFO: Calling the GUI helper to prompt the user to use a different USB port ... prompt-user "Custom setup script NOT found! Please disconnect the USB media and connect it to another USB port. Then click on OK." goto loop :END echo. date /t time /t echo ####### %0 #######