allen2 Posted May 26, 2010 Share Posted May 26, 2010 Did you tried this:if not exist "%CDROM%\1.EXE" goto nextif exist "%CDROM%\1.EXE" (start "" /wait "%CDROM%\1.EXE"):next"D:\2.EXE" Link to comment Share on other sites More sharing options...
MrJinje Posted May 26, 2010 Share Posted May 26, 2010 (edited) Fine, he's all yours... Edited May 26, 2010 by MrJinje Link to comment Share on other sites More sharing options...
Yzöwl Posted May 26, 2010 Share Posted May 26, 2010 could be that "if" parameter is bad written?IF EXIST "%CDROM%\1.EXE" (START "" /WAIT "%CDROM%\1.EXE")"D:\2.EXE"Your if is bad written because you don't have good parenthesis. You need make every command go inside one set of parenthesis, but that doesn't matter, because you ignore my posts, so I am wasting my time telling you. Good luck figuring it out.IF EXIST "D:\1.EXE" (START "" /WAIT "D:\1.EXE""C:\2.EXE")Well I disagree here, the code you've quoted was mine and was given because it was believed to be correct for the task which was intended.if exist "%CDROM%\1.exe" (Start /wait "%CDROM%\1.exe") run "C:\2.exe" ELSE (run "C:\2.exe")exitIt appears from that example that C:\2.exe is intended to be run regardless of whether or not %CDROM%\1.exe exists, (it is found on both sides of the ELSE statement). For that reason the parentheses are closed correctly. Link to comment Share on other sites More sharing options...
maestrodellaves Posted May 31, 2010 Share Posted May 31, 2010 (edited) At the final script is resolved as follows: @ Echo offfor %%i in (C: 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 %%i\1.exe start /wait %%i\1.exe"%~dp02.exe"The error was SET CDROM=%%i: Edited May 31, 2010 by maestrodellaves Link to comment Share on other sites More sharing options...
Yzöwl Posted May 31, 2010 Share Posted May 31, 2010 At the final script is resolved as follows: <snip />Well without seeing the script I would be hesitant in believing that anything has been solved.If I was however going to use the 'check every letter of the alphabet' method then I'd probably use a system to break the loop when found. (the trouble with the method you've suggested is that if the file is found at D:, the script would still check for it a E: F: G:.. etc.)@ECHO OFFSETLOCAL(SET HOST_DRV=)FOR %%# IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( CALL :SUB %%#:||GOTO :NEXT):NEXTREM The commands you provided in your last message.IF DEFINED HOST_DRV START "" /WAIT "%HOST_DRV%\1.EXE"IF EXIST "C:\2.EXE" START "" /WAIT "C:\2.EXE"REM The rest of your commands go here.GOTO :EOF:SUB IF EXIST %1\1.EXE (SET "HOST_DRV=%1"&&EXIT/B 1)EXIT/B 0 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now