In batch scripting, to make the loop stop as soon as the first matching condition is found, you can use the `goto` statement. Here's how you can modify the code:
```batch
@echo off
for %%i in (z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c) do (
if exist %%i:\ghost\winxp.gho (
set drv=%%i
goto :breakLoop REM Jump to the label to exit the loop
)
)
:breakLoop
```
The key change is adding the `goto :breakLoop` inside the `if` block to jump to the label `:breakLoop` once the first match is found, which effectively exits the loop.
```batch
@echo off
for %%i in (z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c) do (
if exist %%i:\ghost\winxp.gho (
set drv=%%i
goto :breakLoop REM Jump to the label to exit the loop
)
)
:breakLoop
```
The key change is adding the `goto :breakLoop` inside the `if` block to jump to the label `:breakLoop` once the first match is found, which effectively exits the loop.
http://sikro.spaces.live.com/
